I'm struggling with a simple operation with the mongodb native driver for nodejs. Here is my mongo document:
{
"_id" : 1,
"foo" : "bar",
"baz" : [
{
"a" : "b",
"c" : 1
},
{
"a" : "b",
"c" : 2
}
]
}
and I have a var like the following :
var removeIt = {"a" : "b", "c" : 1};
So to pull this object from the baz
array I try to do the following :
collection.update(
{_id:1},
{$pull:{baz:{a:removeIt.a, c:removeIt.c}}},
{safe:true},
function(err, result) {}
);
But this doesn't seem to work, and I cannot get why, any idea?