I have following command:
collection.update(
{ "facebook_id": req.params.facebook_id },
{ "$push": { "circles.0.messages": message } }, function(err) {...});
That works fine. But I need the 0 to be a variable. As soon as I change it to:
collection.update(
{"facebook_id": req.params.facebook_id },
{ "$push": { "circles.j.messages": message } }, function(err) {...});
It doesn't work anymore. There is no error, but nothing is being pushed. Tries like:
collection.update(
{"facebook_id':req.params.facebook_id },
{ "$push": { "circles."+j+"j.messages": message } }, function(err) {...});
also won't work.
How can I use a variable in Dot Notation?
Thanks & Best, Marc