Skip to content

Commit

Permalink
docs(NODE-6483): Add documentation for countDocuments $match operator (
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB authored Dec 10, 2024
1 parent 37613f1 commit bc41f2e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,9 @@ export class Collection<TSchema extends Document = Document> {
/**
* Gets the number of documents matching the filter.
* For a fast count of the total documents in a collection see {@link Collection#estimatedDocumentCount| estimatedDocumentCount}.
*
* 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.
*
* **Note**: When migrating from {@link Collection#count| count} to {@link Collection#countDocuments| countDocuments}
* the following query operators must be replaced:
*
Expand Down

0 comments on commit bc41f2e

Please sign in to comment.