Table of Contents

Method Count

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

Count()

Counts the number of documents in this collection.

public virtual long Count()

Returns

long

The number of documents in this collection.

Count(CountArgs)

Counts the number of documents in this collection that match a query.

public virtual long Count(CountArgs args)

Parameters

args CountArgs

The args.

Returns

long

The number of documents in this collection that match the query.

Count(IMongoQuery)

Counts the number of documents in this collection that match a query.

public virtual long Count(IMongoQuery query)

Parameters

query IMongoQuery

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

Returns

long

The number of documents in this collection that match the query.