Method FindOneAs
FindOneAs<TDocument>()
Returns one document in this collection as a TDocument.
public virtual TDocument FindOneAs<TDocument>()
Returns
- TDocument
A TDocument (or null if not found).
Type Parameters
TDocument
The type to deserialize the documents as.
FindOneAs<TDocument>(FindOneArgs)
Returns one document in this collection as a TDocument.
public virtual TDocument FindOneAs<TDocument>(FindOneArgs args)
Parameters
args
FindOneArgsThe args.
Returns
- TDocument
A TDocument (or null if not found).
Type Parameters
TDocument
The type of the document.
FindOneAs<TDocument>(IMongoQuery)
Returns one document in this collection that matches a query as a TDocument.
public virtual TDocument FindOneAs<TDocument>(IMongoQuery query)
Parameters
query
IMongoQueryThe query (usually a QueryDocument or constructed using the Query builder).
Returns
- TDocument
A TDocument (or null if not found).
Type Parameters
TDocument
The type to deserialize the documents as.
FindOneAs(Type)
Returns one document in this collection as a TDocument.
public virtual object FindOneAs(Type documentType)
Parameters
documentType
TypeThe nominal type of the documents.
Returns
- object
A document (or null if not found).
FindOneAs(Type, FindOneArgs)
Returns one document in this collection as a TDocument.
public virtual object FindOneAs(Type documentType, FindOneArgs args)
Parameters
documentType
TypeThe nominal type of the documents.
args
FindOneArgsThe args.
Returns
- object
A document (or null if not found).
FindOneAs(Type, IMongoQuery)
Returns one document in this collection that matches a query as a TDocument.
public virtual object FindOneAs(Type documentType, IMongoQuery query)
Parameters
documentType
TypeThe type to deserialize the documents as.
query
IMongoQueryThe query (usually a QueryDocument or constructed using the Query builder).
Returns
- object
A TDocument (or null if not found).