Last active
November 8, 2017 20:20
-
-
Save jrgcubano/011b896fee6f434e390d21dc223cdaa9 to your computer and use it in GitHub Desktop.
Mongo collection multiple update with pull test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// candidate a producto | |
// get elemecodes from candidate | |
var canditateId = ""; | |
var elemCodes = [ "1", "2", "3"]; | |
// var candidates = monnog. | |
candidates.update( | |
{ _id: { $ne: canditateId }, elems: { code: { $in: elemCodes } } }, | |
{ $pull: { elems: { $elemMatch: { code: { $in: elemCodes } } } } } , | |
{ multi: true }, | |
function (err) { | |
if (err) return callback("Error deleting " + err.message); | |
callback(null, "hello"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment