Method FindOneByIdAs
FindOneByIdAs<TDocument>(BsonValue)
Returns a cursor that can be used to find one document in this collection by its _id value as a TDocument.
public virtual TDocument FindOneByIdAs<TDocument>(BsonValue id)
Parameters
id
BsonValueThe id of the document.
Returns
- TDocument
A TDocument (or null if not found).
Type Parameters
TDocument
The nominal type of the document.
FindOneByIdAs(Type, BsonValue)
Returns a cursor that can be used to find one document in this collection by its _id value as a TDocument.
public virtual object FindOneByIdAs(Type documentType, BsonValue id)
Parameters
Returns
- object
A TDocument (or null if not found).