I have the following in Meteor user profile:
{
"_id": "dwdtWPFjugF3sTLmE",
"emails": [
{
"address": "armin@four1five.com",
"verified": false
}
],
"profile": {
"name": "Armin",
"tasks": [
{
"task": "Task one",
"completed": false,
"created": "2017-10-16T18:48:21.331Z"
},
{
"task": "Task Two",
"completed": false,
"created": "2017-10-16T18:48:25.898Z"
}
]
},
"username": "armin"
}
How do i query by "created", and update the "completed" field? or what is wrong with my approach:
Meteor.users.update(
{ _id: Meteor.userId(), "profile.tasks.created": created },
{
$set: {
'profile.tasks.completed': completed
}
}
);