Package dev.morphia.aggregation.stages
Class Unwind
java.lang.Object
dev.morphia.aggregation.stages.Stage
dev.morphia.aggregation.stages.Unwind
Deconstructs an array field from the input documents to output a document for each element. Each output document is the input document
with the value of the array field replaced by the element.
-
Method Summary
Modifier and TypeMethodDescriptionincludeArrayIndex
(String name) Optional.preserveNullAndEmptyArrays
(Boolean preserveNullAndEmptyArrays) Optional.static Unwind
Creates a stage with the named array field
-
Method Details
-
unwind
Creates a stage with the named array field- Parameters:
name
- the array field- Returns:
- this
- Since:
- 2.2
- MongoDB documentation
- Aggregration Pipeline Stage: $unwind
-
includeArrayIndex
Optional. The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $.- Parameters:
name
- the new name- Returns:
- this
-
preserveNullAndEmptyArrays
Optional.- If true, if the path is null, missing, or an empty array, $unwind outputs the document.
- If false, if path is null, missing, or an empty array, $unwind does not output a document.
- Parameters:
preserveNullAndEmptyArrays
- true to preserve- Returns:
- this
-