My JSON file contains the following data:
[
{"person_id": "3455666", "person_app": "bjjiu877y"},
{"person_id": "5633444", "person_app": "rh5556ggg"},
{"person_id": "9866654", "person_app": "66he4455"},
......
]
// The array length could range from 100k to 200k
In my person_collection, there is no field for person_app
, and the identifier is person_id
I want to update the person_collection document to include the person_app
I attempted to achieve this using a JavaScript script in a separate file:
for( let {person_id, person_app} of dataFromJson) {
db.person_collection.update({person_id}, {"set": {person_app}})
}
The updating process took a long time, and I am unsure if all the data was updated. How can I efficiently update this large dataset while ensuring that all the records are successfully updated? Thank you.