Deconstructs an array field, outputting a document for each element. Options available.
Stages Options
Stage
Option
$bucket
groupBy: An expression to group by.
boundaries: An array specifying the boundaries to group documents.
default: A literal that specifies the _id of an additional group for all documents that do not match any boundary.
$bucketAuto
groupBy: An expression to group by.
buckets: The number of buckets to create.
$currentOp
allUsers: A boolean indicating if operations from all users should be returned.
localOps: A boolean indicating if only operations on the local mongod instance should be returned.
$geoNear
near: The geospatial point to calculate distances from.
distanceField: The field that will contain the calculated distance.
spherical: A boolean specifying whether to treat the near point as a sphere.
maxDistance: The maximum distance from the near point that the documents can be.
$graphLookup
from: The target collection for the recursive search.
startWith: The expression that specifies the value of the connectFromField with which to start the recursive search.
connectFromField: The field whose value startWith references.
connectToField: The field in the documents of the from collection that is equal to the connectFromField.
as: The array field added to each output document that contains the search results.
$lookup
from: The target collection.
localField: The field from the input documents.
foreignField: The field from the documents of the from collection.
as: The name of the new array field to add to the input documents.
$merge
into: The target collection.
on: The fields to match on.
whenMatched: The action to take when a matching document exists.
whenNotMatched: The action to take when no matching document exists.
$out
collection: The target collection.
$sample
size: The number of documents to randomly select.
$unionWith
coll: The name of the collection to union with.
pipeline: An optional aggregation pipeline to apply to the specified collection before performing the union.
$unwind
path: The path to the array field to unwind.
includeArrayIndex: The name of a new field to hold the array index of the element.
preserveNullAndEmptyArrays: A boolean indicating whether to include as an output document those documents that have an empty array or missing array field.