I need to update a document in an array inside another document in Mongo DB
{
\"_id\" : ObjectId(\"51cff693d342704b5047e6d8\"),
\"aut
If you are trying to do it dynamically in Node JS following should work.
i = 0;
selector = {};
operator = {};
selector['comments.' + i + '.email'] = 1; // {'comments.0.num_likes' : 1}
operator['$inc'] = selector; // {'$inc' : {'comments.0.num_likes' : 1} }
db.posts.update({'permalink' : 'xyz'}, operator);