Reputation: 119
i would like to remove a object from an array that matches "market"
my document:
{
_id: "brTuuCYhdcQSsr2xL",
marketConfig: [
{ market: "de", value: 123 }
{ market: "cn", value: 456 }
]
}
my javascript code:
Database.update(
{ _id: "brTuuCYhdcQSsr2xL" },
{ $pull: { marketConfig: { market: "de" } } },
);
after i fire this js code, the document looks like still the same
i am confused... i got no errors messages with this...
Upvotes: 0
Views: 71
Reputation: 672
Try this,
Database.update(
{ _id: "brTuuCYhdcQSsr2xL" },
{ $pull: { marketConfig: { market: "de" } } },
false,
true
);
you have to commit your query by passing the boolean parameters.
Upvotes: 1