Stop and fail the aggregation operation.
Stop and fail the aggregation operation. Any changes to the output collection from previous documents are not reverted.
Keep the existing document in the output collection.
Merge the matching documents
An aggregation pipeline to update the document in the collection.
An aggregation pipeline to update the document in the collection.
#whenMatchedPipeline(List)
Replace the existing document in the output collection with the matching results document.
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).