MongoDB.Driver.Collection.FindOne C# (CSharp) Метод

FindOne() публичный Метод

Finds and returns the first document in a query.
public FindOne ( Document spec ) : Document
spec Document /// A representing the query. ///
Результат Document
        public Document FindOne(Document spec)
        {
            ICursor cur = this.Find(spec, -1, 0, null);
            foreach(Document doc in cur.Documents){
                cur.Dispose();
                return doc;
            }
            //FIXME Decide if this should throw a not found exception instead of returning null.
            return null; //this.Find(spec, -1, 0, null)[0];
        }