Package com.mongodb.client.model
Class MergeOptions
java.lang.Object
com.mongodb.client.model.MergeOptions
Options to control the behavior of the $merge aggregation stage
- Since:
 - 3.11
 - See Also:
 - MongoDB documentation
 - $merge stage
 - Since server release
 - 4.2
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s).static enumThe behavior of $merge if a result document does not match an existing document in the out collection. - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the fields that act as a unique identifier for a document.Gets the variables accessible for use in the whenMatched pipelineGets the behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s).List<org.bson.conversions.Bson>Gets aggregation pipeline to update the document in the collection.Gets the behavior of $merge if a result document does not match an existing document in the out collection.inthashCode()toString()uniqueIdentifier(String uniqueIdentifier) Sets the field that act as a unique identifier for a document.uniqueIdentifier(List<String> uniqueIdentifier) Sets the field that act as a unique identifier for a document.Sets the variables accessible for use in the whenMatched pipeline.whenMatched(MergeOptions.WhenMatched whenMatched) Sets the behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s).whenMatchedPipeline(List<org.bson.conversions.Bson> whenMatchedPipeline) Sets aggregation pipeline to update the document in the collection.whenNotMatched(MergeOptions.WhenNotMatched whenNotMatched) Sets the behavior of $merge if a result document does not match an existing document in the out collection. 
- 
Constructor Details
- 
MergeOptions
public MergeOptions() 
 - 
 - 
Method Details
- 
getUniqueIdentifier
Gets the fields that act as a unique identifier for a document. The identifier determine if a results document matches an already existing document in the output collection.- Returns:
 - the unique identifier
 
 - 
uniqueIdentifier
Sets the field that act as a unique identifier for a document. The identifier determine if a results document matches an already existing document in the output collection.- Parameters:
 uniqueIdentifier- the unique identifier- Returns:
 - this
 
 - 
uniqueIdentifier
Sets the field that act as a unique identifier for a document. The identifier determine if a results document matches an already existing document in the output collection.- Parameters:
 uniqueIdentifier- the unique identifier- Returns:
 - this
 
 - 
getWhenMatched
Gets the behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s).- Returns:
 - when matched
 
 - 
whenMatched
Sets the behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s).- Parameters:
 whenMatched- when matched- Returns:
 - this
 
 - 
getVariables
Gets the variables accessible for use in the whenMatched pipeline- Returns:
 - the variables
 
 - 
variables
Sets the variables accessible for use in the whenMatched pipeline.- Parameters:
 variables- the variables- Returns:
 - this
 
 - 
getWhenMatchedPipeline
Gets aggregation pipeline to update the document in the collection.- Returns:
 - when matched pipeline
 - See Also:
 
 - 
whenMatchedPipeline
Sets aggregation pipeline to update the document in the collection.- Parameters:
 whenMatchedPipeline- when matched pipeline- Returns:
 - this
 - See Also:
 
 - 
getWhenNotMatched
Gets the behavior of $merge if a result document does not match an existing document in the out collection.- Returns:
 - when not matched
 
 - 
whenNotMatched
Sets the behavior of $merge if a result document does not match an existing document in the out collection.- Parameters:
 whenNotMatched- when not matched- Returns:
 - this
 
 - 
equals
 - 
hashCode
public int hashCode() - 
toString
 
 -