MongoCollection.findOne

Queries the collection for existing documents.

  1. auto findOne(T query, U returnFieldSelector, QueryFlags flags)
  2. auto findOne(T query)
    struct MongoCollection
    findOne
    (
    R = Bson
    T
    )
    ()

Return Value

Type: auto

By default, a Bson value of the matching document is returned, or Bson(null) when no document matched. For types R that are not Bson, the returned value is either of type R, or of type $(Nullable!R), if R is not a reference/pointer type.

Throws

Exception if a DB communication error or a query error occurred.

See Also

Meta