/* 1 */
{
"_id" : ObjectId("5b17aa58240d110001387ddd"),
"user_id" : ObjectId("5896baf66b95266c0686a917"),
"name" : "My Collection",
"lower_case_name" : "my collection",
"problem_ids" : [
ObjectId("5b17a952240d110001f2a0fc")
],
"created_at" : ISODate("2018-06-06T09:33:12.734Z"),
"modified_at" : ISODate("2018-06-11T11:09:47.805Z")
}
/* 2 */
{
"_id" : ObjectId("5b1e4f9b240d110001444432"),
"user_id" : ObjectId("5896baf66b95266c0686a917"),
"name" : "Halla",
"lower_case_name" : "halla",
"problem_ids" : [
ObjectId("5b17a952240d110001f2a0fc")
],
"created_at" : ISODate("2018-06-11T10:31:55.924Z"),
"modified_at" : ISODate("2018-06-11T11:09:45.406Z")
}
I want to remove problem_ids
ObjectId("5b17a952240d110001f2a0fc")
in a single query currently I am doing
db.collections.update({"user_id": ObjectId("5896baf66b95266c0686a917")}, {$pull: {problem_ids: ObjectId("5b17a952240d110001f2a0fc")}})
But it only removes from the first document