I want to remove all embedded documents from a collection, but I can’t figure out how to do that.
I have tried a few ways, but I think this one should work:
Products.update({_id: data._id}, { $pull : { orders : {$gte: 0} } });
Products is the collection, orders is the array with embedded documents.
Remove all orders where the index is greater or equal than 0.
No luck.
Try this
or this