| |
read source history
= estimatedDocumentCount() =
----
[[MongoDB Driver Function Reference]]
Returns the count of all documents in a collection or view.
More information can be found in the corresponding entry of the [[https://docs.mongodb.com/manual/reference/method/db.collection.estimatedDocumentCount/index.html|MongoDB Manual]].
[[[@cG
<collection>.estimatedDocumentCount([<options>])
]]]
**Arguments**
[[[@w
|@t0@r0@c0 <collection> | | The target collection. |
| <options> | | A BOSN document specifying options. |
]]]
**Options**
[[[@cw
{ maxTime: <long> }
<<@f:text>>
|@t0@r0@c0 maxTime | | The maximum amount of time to allow the count to run. |
<<@/f>>
]]]
**Return Value**
[[[@w
Returns a result set (cursor).
]]]
**Example**
[[[@cw
db.employees.estimatedDocumentCount({ salary: { $gt: 700000 }});
]]]
Returns the number of documents in the //employees// collection.
----
[[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]]
|