Suppose I have a MongoDB collection called Posts with documents like this:
{
_id: 11111,
time:40
}
How can I dynamically add a numeric value to the 'time' field using the .update method to achieve the following result?
{
_id: 11111,
time:50
}
I tried something like this:
Posts.update(this._id, {
$set: {time:{time+10}}
});
But it doesn't seem to work. Is there a way to accomplish this? Any suggestions?