-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: mongoimport
-
None
-
Needed
Let's say I have a mongodb collection named customer where each record has this structure :
{ "_id" : 1, "name" : "Joe Smith", "addresses" : [
{ "address1" : "123 Rd", "city" : "LA"}]}
Let's also save I have a file of newline separated JSON's with the following structure:
{ "_id" : 1, "addresses" : [
{"address1" : "123 Another Street", "city" : "LA"}] }
After a mongoimport --merge, I'd like the first record to become:
{ "_id" : 1, "name" : "Joe Smith", "addresses" : [
{"address1" : "123 Another Street", "city" : "LA"}] }
In other words, name field is left untouched because not mentioned in the update, while addresses field is entirely replaced.
The current behavior when using the --upsert option is to replace the entire record (in this example eliminating the name field entirely).
- is duplicated by
-
SERVER-9943 Add option for mongoimport to upsert with $set instead of replacing the updated documents
- Closed