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
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Deprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the MongoDB operator that is used for thisAggregationOperation
.Optionally specify the database of the target collection.Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
.mode
(OutOperation.OutMode mode) Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
.Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
.Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
.org.bson.Document
toDocument
(AggregationOperationContext context) Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
.uniqueKeyOf
(Iterable<String> fields) Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.mongodb.core.aggregation.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
-
uniqueKey
Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
. Support for the extended syntax has been removed with MongoDB 5, useMergeOperation
instead.Optionally specify the field that uniquely identifies a document in the target collection.
For convenience the given key can either be a single field name or the Json representation of a keyDocument
.// { // "field-1" : 1 // } .uniqueKey("field-1") // { // "field-1" : 1, // "field-2" : 1 // } .uniqueKey("{ 'field-1' : 1, 'field-2' : 1}")
NOTE: Only suitable for 4.2+ to (not including) 5.0.- Parameters:
key
- can be null. Server uses _id when null.- Returns:
- new instance of
OutOperation
. - Since:
- 2.2
-
uniqueKeyOf
@Deprecated(since="4.5.1", forRemoval=true) public OutOperation uniqueKeyOf(Iterable<String> fields) Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
. Support for the extended syntax has been removed with MongoDB 5, useMergeOperation
instead.Optionally specify the fields that uniquely identifies a document in the target collection.
// { // "field-1" : 1 // "field-2" : 1 // } .uniqueKeyOf(Arrays.asList("field-1", "field-2"))
NOTE: Only suitable for 4.2+ to (not including) 5.0.- Parameters:
fields
- must not be null.- Returns:
- new instance of
OutOperation
. - Since:
- 2.2
-
mode
Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
. Support for the extended syntax has been removed with MongoDB 5, useMergeOperation
instead.Specify how to merge the aggregation output with the target collection.
NOTE: Only suitable for 4.2+ to (not including) 5.0.- Parameters:
mode
- must not be null.- Returns:
- new instance of
OutOperation
. - Since:
- 2.2
-
replaceCollection
Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
. Support for the extended syntax has been removed with MongoDB 5, useMergeOperation
instead.Replace the target collection.
NOTE: Only suitable for 4.2+ to (not including) 5.0.- Returns:
- new instance of
OutOperation
. - Since:
- 2.2
- See Also:
-
replaceDocuments
Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
. Support for the extended syntax has been removed with MongoDB 5, useMergeOperation
instead.Replace/Upsert documents in the target collection.
NOTE: Only suitable for 4.2+ to (not including) 5.0.- Returns:
- new instance of
OutOperation
. - Since:
- 2.2
- See Also:
-
insertDocuments
Deprecated, for removal: This API element is subject to removal in a future version.extended$out
syntax was superseded by$merge
. Support for the extended syntax has been removed with MongoDB 5, useMergeOperation
instead.Insert documents to the target collection.
NOTE: Only suitable for 4.2+ to (not including) 5.0.- Returns:
- new instance of
OutOperation
. - Since:
- 2.2
- See Also:
-
toDocument
Description copied from interface:AggregationOperation
- Specified by:
toDocument
in interfaceAggregationOperation
- Parameters:
context
- theAggregationOperationContext
to operate within. Must not be null.- Returns:
- the Document
-
getOperator
Description copied from interface:AggregationOperation
Return the MongoDB operator that is used for thisAggregationOperation
. Aggregation operations should implement this method to avoid document rendering.- Specified by:
getOperator
in interfaceAggregationOperation
- Returns:
- the operator used for this
AggregationOperation
.
-
$out
syntax was superseded by$merge
.