I am running the below query and It does not work. When I run the query part in mongo UI, it returns me expected result. I am using UMongo. But it does not update the document as expected.
db.system.js.save ({
_id:"script_1",
value: function() {
print("in function>>");
db.data.find({"$and":
[{"title":{$regex : '.*Green Red.*', $options : 's'}},
{"editor.key": {"$in": ["74014","45339"]}}, {"types" : {"$in": ["Notes"]}}]}).forEach(
function(docMatch){
print("Matching document found");
db.data.update(docMatch,
{$set:{"editor.key": "05335","editor.value": "editor1",
"editor.email": "editor1@gmail.com"}
}, false, true);
}
);
db.data.reIndex();
}
});
db.eval("script_1()");
I do see "Matching document found" in the mongo logs but does not update. Shows below message too in the logs.
Thu Sep 19 11:03:43 [conn1279] warning: ClientCursor::yield can't unlock b/c of recursive lock ns
Thanks for you help !