I have a collection like this
{
_id: "qex6zPLgigq4KGpFP",
active: true,
name: "event name",
questions: [{
_id: "cff4cc7f1ae67282f1ea142b",
createdBy: "izRFAkhxgemihkRMF",
likes: 2
}, {
_id: "2cf23241ca456703f50a9ce4",
createdBy: "izRFAkhxgemihkRMF",
likes: 0
}]
}
and I initialize my collection in my Meteor application like this:
Events = new Mongo.Collection("events");
Now I want to remove a subdocument from the 'questions' array and it works in the shell with
db.events.update({_id:"qex6zPLgigq4KGpFP"}, {$pull: {'questions': {_id:"cff4cc7f1ae67282f1ea142b"}}})
but NOT in Meteor by calling
Events.update({_id:"qex6zPLgigq4KGpFP"}, {$pull: {'questions': {_id:"cff4cc7f1ae67282f1ea142b"}}})
The return value is always '1', but the document is still there. It's confusing. Any ideas?