Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
APPLIES TO:
MongoDB vCore
The $count
stage in the aggregation pipeline is used to count the number of documents that pass through the pipeline. This stage outputs a document with a single field containing the count of the documents. It's useful when you need to determine the number of documents that match certain criteria or passed through various stages of transformation in the pipeline.
Syntax
{
$count: <field>
}
Parameters
Description | |
---|---|
field |
The name of the field in the output document where the count is stored. |
Related content
- Review options for Migrating from MongoDB to Azure Cosmos DB for MongoDB (vCore)
- Read more about Feature compatibility with MongoDB