$count and $facet
Count and run sub pipelines.
Example
db.users.aggregate([
{ $match: { active: true } },
{ $count: "active" }
])Exercise
Count stage.
{ : "n" }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.