Skip to content

Commit bc41f2e

Browse files
docs(NODE-6483): Add documentation for countDocuments $match operator (#4342)
1 parent 37613f1 commit bc41f2e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/collection.ts

+3
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,9 @@ export class Collection<TSchema extends Document = Document> {
765765
/**
766766
* Gets the number of documents matching the filter.
767767
* For a fast count of the total documents in a collection see {@link Collection#estimatedDocumentCount| estimatedDocumentCount}.
768+
*
769+
* Due to countDocuments using the $match aggregation pipeline stage, certain query operators cannot be used in countDocuments. This includes the $where and $near query operators, among others. Details can be found in the documentation for the $match aggregation pipeline stage.
770+
*
768771
* **Note**: When migrating from {@link Collection#count| count} to {@link Collection#countDocuments| countDocuments}
769772
* the following query operators must be replaced:
770773
*

0 commit comments

Comments
 (0)