Table of Contents

Method FindOne

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

FindOne()

Returns one document in this collection as a TDefaultDocument.

public virtual TDefaultDocument FindOne()

Returns

TDefaultDocument

A TDefaultDocument (or null if not found).

FindOne(IMongoQuery)

Returns one document in this collection that matches a query as a TDefaultDocument.

public virtual TDefaultDocument FindOne(IMongoQuery query)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

Returns

TDefaultDocument

A TDefaultDocument (or null if not found).