Reputation: 1
With mongojs we need to update the document with something like below given code
db.data.update(
{
"title": {$regex : '.*Green Red.*', $options : 's'},
"editor.key": {"$in": ["74014","45339"]},`enter code here`
"types" : "Notes"
},
{
$set: {
"editor.key": "05335",
"editor.value": "editor1",
"editor.email": "[email protected]"
}
},
false,
true
);
But the problem is its really not dynamic
exports.updatePerson = function(Person , onDone) {
Person.UpdatedOn = new Date();
db.people.save(nodd, function (err) {
onDone();
});
But its creating a duplicate record
Upvotes: 0
Views: 807
Reputation: 338
try this :
db.data.update(
{
"title": {$regex : '.*Green Red.*', $options : 's'},
"editor.key": {"$in": ["74014","45339"]},`enter code here`
"types" : "Notes"
},
{
$set: {
"editor.key": "05335",
"editor.value": "editor1",
"editor.email": "[email protected]"
}
},{
insert:false,
multi : true
}
);
insert and multi parameter should be fields of an object
Upvotes: 1