1//db.collection.findOneAndUpdate( filter, update, options )
2//{ $pull: { <field1>: <value|condition>} }
3
4List.findOneAndUpdate({ name: listName }, { $pull: { <field1>: <value|condition> } }, function(err, foundList) {
5 if (!err) {
6 //your code
7 }
8}); //Here List is my collection name
9
10//By Reacto Kalyan
1db.survey.update( // select your doc in moongo
2 { }, // your query, usually match by _id
3 { $pull: { results: { $elemMatch: { score: 8 , item: "B" } } } }, // item(s) to match from array you want to pull/remove
4 { multi: true } // set this to true if you want to remove multiple elements.
5)
6
1Favorite.updateOne( {cn: req.params.name}, { $pullAll: {uid: [req.params.deleteUid] } } )