mongodb :: MongoPipeline :: group
https://docs.mongodb.com/manual/reference/operator/aggregation/group/
Groups documents by some specified expression and outputs to the next stage a document for each distinct grouping.
The output documents contain an _id
field which contains the distinct
group by key.
The output documents can also contain computed fields that hold the values
of some accumulator expression grouped by the $group
's _id
field.
$group
does not order its output documents.
{ $group: { <group> } }
# Apply group
#
# https://docs.mongodb.com/manual/reference/operator/aggregation/group/
#
# Groups documents by some specified expression and outputs to the next stage
# a document for each distinct grouping.
#
# The output documents contain an `_id` field which contains the distinct
# group by key.
#
# The output documents can also contain computed fields that hold the values
# of some accumulator expression grouped by the `$group`'s `_id` field.
# `$group` does not order its output documents.
#
# ~~~json
# { $group: { <group> } }
# ~~~
fun group(group: MongoGroup): MongoPipeline do return add_stage("group", group)
lib/mongodb/queries.nit:464,2--481,80