I've a schema like this:
orders = {"productIds:[1,2]}
products = {"_id": 1}
I want to pull the value 1 (for example) in the array productIds to all orders that contains this value.
I've tried with:
db.orders.update({productIds: {$elemMatch: {$eq: 1}}},{$pull: {productIds: 1}})
but this query updates only one document that has the value 1 in productIds, not all documents.