Vous voudrez peut-être essayer :
// this returns an array of documents which has the store_id and the minimum price for that store
myresult = db.products.aggregate( [
{ $group:
{ _id: "$store_id",
price: { $min: "$price" }
}
}
] ).result
// loop through the results to remove the documents matching the the store id and price
for (i in myresult) {
db.products.remove(
{ store_id: myresult[i]._id, price: myresult[i].price }
);
}