When you use mongoimport
to import files into MongoDB, you have the option of merging existing documents with the ones that you’re importing.
In this case, if an imported document has the same _id
value as an existing one in the collection that you’re importing into, the existing document will be merged with the one being imported.
You can also specify another field (other than the _id
field) to be the matching field if required.