Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
APPLIES TO:
MongoDB vCore
The $mergeObjects
operator is used to combine multiple documents into a single document. This operator is useful in aggregation pipelines when you need to merge fields from different documents or add another field to an existing document. The behavior of $mergeObjects
is to overwrite fields in the target document with fields from the source document when there are conflicts.
{ $mergeObjects: [ <document1>, <document2>, ... ] }
Description | |
---|---|
document1, document2 |
These documents are targeted for merge. The documents can be specified as field paths, subdocuments, or constants. |
- Review options for Migrating from MongoDB to Azure Cosmos DB for MongoDB (vCore)
- Read more about Feature compatibility with MongoDB