Reputation: 11045
I'm getting error message Uncaught Error: When the modifier option is true, validation object must have at least one operator
I've looked at a number of similar questions, but haven't been able to decipher what's wrong with my query:
Meteor.users.update({
_id: Meteor.user()._id
}, {
$set: {
"emails.letter": true
}
})
My MongoDB structure is as follows:
{
"_id": "ujkwQp4rYTKQeLq3F",
"emails": [{
"address": "[email protected]",
"letter": false
}]
}
Upvotes: 1
Views: 279
Reputation: 2010
You need to specify which element in the array you want to update. Try this:
Meteor.users.update({
_id : 123456,
"emails.address":"[email protected]"
}, {
$set: {
"emails.$.letter": true
}
});
Upvotes: 1