Table of Contents

Enum MergeStageWhenMatched

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

The behavior of $merge is a result document and an existing document in the collection have the same value for the specified on field(s).

public enum MergeStageWhenMatched

Fields

Replace = 0

Replace the existing document in the output collection with the matching results document.

KeepExisting = 1

Keep the existing document in the output collection.

Merge = 2

Merge the matching documents (similar to the $mergeObjects operator).

Fail = 3

Stop and fail the aggregation. Any changes to the output collection from previous documents are not reverted.

Pipeline = 4

Use an aggregation pipeline to update the document in the collection.