Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = [
- {'name':'Ajay','marks':20},
- {'name':'Pinku','marks':12},
- {'name':'Vinod','marks':50},
- {'name':'Rahul','marks':80}
- ];
- let operations = input.map(function(student){
- return {updateOne:{filter:{name:student.name},update:{$set:{marks:student.marks}}
- };
- db.collection.bulkWrite(operations);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement