Hi, I'm new to mongo so hopefully this isn't a foolish question. I have a document schema set up like
tracks:
dataPoints = [ DataPoints]
So dataPoints are an embedded document list inside of a track.
I am trying to remove data points from the list based on Id. In the mongo shell I can do this:
db.tracks.update({}, {$pull : {'dataPoints' : { '_id' : { $in : [ ObjectId("514f90664a12b4441800007e") ] }}}}, false, true);
And this works fine.
Using mongoose however, if I have a mongoose object that has an ObjectId property I can't just do
schema.Track.update({}, {
$pull: {
dataPoints: {
_id: {
$in: [points[0]._id]
}
}
}
}, {
multi: true,
upsert: false
}, function (err) {
return callback(err);
});
I get no error, but nothing happens. I've validated that points[0]._id is a mongoose ObjectId type. Any ideas whats going on here? I don't get any errors just nothing is committed.