Creates an $addFields
pipeline stage
Creates an $addFields
pipeline stage
the fields to add
the $addFields
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $bucket
pipeline stage
Creates a $bucket
pipeline stage
the groupBy expression type
the boundary type
the criteria to group By
the optional values for the $bucket
stage
the boundaries of the buckets
the $bucket
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $bucket
pipeline stage
Creates a $bucket
pipeline stage
the groupBy expression type
the boundary type
the criteria to group By
the boundaries of the buckets
the $bucket
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $bucketAuto
pipeline stage
Creates a $bucketAuto
pipeline stage
the groupBy expression type
the criteria to group By
the number of the buckets
the optional values for the $bucketAuto
stage
the $bucketAuto
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $bucketAuto
pipeline stage
Creates a $bucketAuto
pipeline stage
the groupBy expression type
the criteria to group By
the number of the buckets
the $bucketAuto
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $count
pipeline stage using the named field to store the result
Creates a $count
pipeline stage using the named field to store the result
the field in which to store the count
the $count
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $count
pipeline stage using the field name "count" to store the result
Creates a $count
pipeline stage using the field name "count" to store the result
the $count
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $facet
pipeline stage
Creates a $facet
pipeline stage
the facets to use
the new pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $match
pipeline stage for the specified filter
Creates a $match
pipeline stage for the specified filter
A friendly alias for the match
method.
the filter to match against
the $match
pipeline stage
Filters
Creates a graphLookup pipeline stage for the specified filter
Creates a graphLookup pipeline stage for the specified filter
the expression type
the collection to query
the expression to start the graph lookup with
the from field
the to field
name of field in output document
optional values for the graphLookup
the $graphLookup
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $graphLookup
pipeline stage for the specified filter
Creates a $graphLookup
pipeline stage for the specified filter
the expression type
the collection to query
the expression to start the graph lookup with
the from field
the to field
name of field in output document
the $graphLookup
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $group
pipeline stage for the specified filter
Creates a $group
pipeline stage for the specified filter
the expression type
the id expression for the group
zero or more field accumulator pairs
the $group
pipeline stage
Creates a $limit
pipeline stage for the specified filter
Creates a $limit
pipeline stage for the specified filter
the limit
the $limit
pipeline stage
Creates a $lookup
pipeline stage, joining the current collection with the one specified in from using the given pipeline
Creates a $lookup
pipeline stage, joining the current collection with the one specified in from using the given pipeline
the name of the collection in the same database to perform the join with.
the variables to use in the pipeline field stages.
the pipeline to run on the joined collection.
the name of the new array field to add to the input documents.
the $lookup
pipeline stage
2.3
Requires MongoDB 3.6 or greater
Creates a $lookup
pipeline stage, joining the current collection with the one specified in from using the given pipeline
Creates a $lookup
pipeline stage, joining the current collection with the one specified in from using the given pipeline
the name of the collection in the same database to perform the join with.
the pipeline to run on the joined collection.
the name of the new array field to add to the input documents.
the $lookup
pipeline stage:
2.3
Requires MongoDB 3.6 or greater
Creates a $lookup
pipeline stage for the specified filter
Creates a $lookup
pipeline stage for the specified filter
the name of the collection in the same database to perform the join with.
specifies the field from the local collection to match values against.
specifies the field in the from collection to match values against.
the name of the new array field to add to the input documents.
the $lookup
pipeline stage
1.1
Requires MongoDB 3.2 or greater
Creates a $match
pipeline stage for the specified filter
Creates a $match
pipeline stage for the specified filter
the filter to match
the $match
pipeline stage
Filters
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
the namespace to merge into
the mergeOptions
the $merge
pipeline stage
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
the namespace to merge into
the $merge
pipeline stage
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
the name of the collection to merge into
the mergeOptions
the $merge
pipeline stage
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
Creates a $merge
pipeline stage that merges into the specified collection using the specified options.
the name of the collection to merge into
the $merge
pipeline stage
Creates a $out
pipeline stage that supports outputting to a different database.
Creates a $out
pipeline stage that supports outputting to a different database.
the database name
the collection name
the $out
pipeline stage
Creates a $out
pipeline stage that writes to the collection with the specified name
Creates a $out
pipeline stage that writes to the collection with the specified name
the collection name
the $out
pipeline stage
Creates a $project
pipeline stage for the specified projection
Creates a $project
pipeline stage for the specified projection
the projection
the $project
pipeline stage
Projections
Creates a $replaceRoot
pipeline stage
Creates a $replaceRoot
pipeline stage
the new root type
the new root value
the $replaceRoot
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Creates a $replaceRoot
pipeline stage
Creates a $replaceRoot
pipeline stage
With $replaceWith
, you can promote an embedded document to the top-level.
You can also specify a new document as the replacement.
The $replaceWith
is an alias for replaceRoot.
the new root type
the new root value
the $replaceRoot
pipeline stage
2.7
Creates a $sample
pipeline stage with the specified sample size
Creates a $sample
pipeline stage with the specified sample size
the sample size
the $sample
pipeline stage
1.1
Creates a $skip
pipeline stage
Creates a $skip
pipeline stage
the number of documents to skip
the $skip
pipeline stage
Creates a $sort
pipeline stage for the specified sort specification
Creates a $sort
pipeline stage for the specified sort specification
the sort specification
Sorts
Creates a $sortByCount
pipeline stage for the specified filter
Creates a $sortByCount
pipeline stage for the specified filter
the expression type
the filter specification
the $sortByCount
pipeline stage
1.2
Requires MongoDB 3.4 or greater
Sorts
Creates a $unionWith
pipeline stage.
Creates a $unionWith
pipeline stage.
the name of the collection in the same database to perform the union with.
the pipeline to run on the union.
the $unionWith
pipeline stage
Creates a $unwind
pipeline stage for the specified field name, which must be prefixed by a $
sign.
Creates a $unwind
pipeline stage for the specified field name, which must be prefixed by a $
sign.
the field name, prefixed by a $
sign
the $unwind
pipeline stage
1.1
Creates a $unwind
pipeline stage for the specified field name, which must be prefixed by a $
sign.
Creates a $unwind
pipeline stage for the specified field name, which must be prefixed by a $
sign.
the field name, prefixed by a $
sign
the $unwind
pipeline stage
(Since version ) see corresponding Javadoc for more information.
Builders for aggregation pipeline stages.
1.0
Aggregation pipeline