Table of Contents

Method FindOneById

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

FindOneById(BsonValue)

Returns a cursor that can be used to find one document in this collection by its _id value as a TDefaultDocument.

public virtual TDefaultDocument FindOneById(BsonValue id)

Parameters

id BsonValue

The id of the document.

Returns

TDefaultDocument

A TDefaultDocument (or null if not found).