Home > Enterprise >  MongoDB API Document count
MongoDB API Document count

Time:01-03

Is there a way to check the count of documents using MongoDB API? (Data API POST requests) There are examples of insert, update and delete inside Their documentation, but there is nothing about aggregation or anything related to the queries that make using count possible.

Link to the documentation: link

I tried to look into the documentation, but it is short and contains only basic actions. Found that it sends the amount of updated documents in the response to delete or update action. It is the only "count-like" response I could find.

Are there really no ways in MongoDB API to check for the amount of documents with applied filters to the query?

CodePudding user response:

The data API exposes an aggregation resource.

The $count stage return the count of documents in the pipeline.

  • Related