Class OutOperation
java.lang.Object
org.springframework.data.mongodb.core.aggregation.OutOperation
- All Implemented Interfaces:
AggregationOperation
Encapsulates the
$out-operation.
We recommend to use the static factory method Aggregation.out(String) instead of creating instances of this
class directly.
- Author:
- Nikolay Bogdanov, Christoph Strobl, Hyunsang Han
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the MongoDB operator that is used for thisAggregationOperation.Optionally specify the database of the target collection.timeSeries(String timeField) Set the time series options for creating a time series collection with only the time field.timeSeries(String timeField, @Nullable String metaField, @Nullable Granularity granularity) Set the time series options for creating a time series collection with time field, meta field, and granularity.timeSeries(CollectionOptions.TimeSeriesOptions timeSeriesOptions) Set the time series options for creating a time series collection.org.bson.DocumenttoDocument(AggregationOperationContext context) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AggregationOperation
toPipelineStages
-
Constructor Details
-
OutOperation
- Parameters:
outCollectionName- Collection name to export the results. Must not be null.
-
-
Method Details
-
in
Optionally specify the database of the target collection.
NOTE: Requires MongoDB 4.2 or later.- Parameters:
database- can be null. Defaulted to aggregation target database.- Returns:
- new instance of
OutOperation. - Since:
- 2.2
-
timeSeries
@Contract("_ -> new") public OutOperation timeSeries(CollectionOptions.TimeSeriesOptions timeSeriesOptions) Set the time series options for creating a time series collection.- Parameters:
timeSeriesOptions- must not be null.- Returns:
- new instance of
OutOperation. - Since:
- 5.0
-
timeSeries
Set the time series options for creating a time series collection with only the time field.- Parameters:
timeField- must not be null or empty.- Returns:
- new instance of
OutOperation. - Since:
- 5.0
-
timeSeries
@Contract("_, _, _ -> new") public OutOperation timeSeries(String timeField, @Nullable String metaField, @Nullable Granularity granularity) Set the time series options for creating a time series collection with time field, meta field, and granularity.- Parameters:
timeField- must not be null or empty.metaField- can be null.granularity- defaults toGranularity.DEFAULTif null.- Returns:
- new instance of
OutOperation. - Since:
- 5.0
-
toDocument
Description copied from interface:AggregationOperation- Specified by:
toDocumentin interfaceAggregationOperation- Parameters:
context- theAggregationOperationContextto operate within. Must not be null.- Returns:
- the Document
-
getOperator
Description copied from interface:AggregationOperationReturn the MongoDB operator that is used for thisAggregationOperation. Aggregation operations should implement this method to avoid document rendering.- Specified by:
getOperatorin interfaceAggregationOperation- Returns:
- the operator used for this
AggregationOperation.
-