robbiblubber.org

help | login | search:  
<<

Home Page
Index

Projects

Utility Suite
Data Suite
Bad Wolf Suite
WeakWiki

User Docs

ConfigNotepad
LED
rqoon
Nuub

Code Docs

.NET
Java
PHP

robbiblubber.org

Specs
Articles

Sources















read  source  history 


countDocuments()


MongoDB Driver Function Reference


Returns the number of documents matching the filter criteria in a collection.
More information can be found in the corresponding entry of the MongoDB Manual.



<collection>.countDocuments([<filter>[, <options>]])



Arguments


<collection> The target collection.
<filter> A filter expression using query operators.
<options> A BOSN document specifying options.



Options


{ maxTime: <long>, limit: <long>, skip: <long>, collation: <document>, hint: <document> }

limit The maximum number of documents to count.
maxTime The maximum amount of time to allow the count to run.
skip The number of documents to skip before counting.
collation A document specifying the collation.
hint A document specifying a hint.



Return Value


Returns a result set (cursor).



Example


db.employees.countDocuments({ salary: { $gt: 700000 }});


Returns the number of documents where the salary value is greater than 700000.




home | MongoDB Driver Function Reference | MongoDB Driver