$count
Reference group: Pipeline stages
What it does
Outputs a document with the count of documents reaching the stage.
Syntax
{$count: "fieldName"}
Use case
Return a pipeline count.
$count: practical example
{ $count: "matchedOrders" }💡 Explanation
Outputs a document with the count of documents reaching the stage.
When to use it
Return a pipeline count.
Key Takeaways
- Outputs a document with the count of documents reaching the stage.
- Typical use: Return a pipeline count.