I'm using the mongodb package on my Nodejs app. I try to remove an nested object. It work when I put a nested object. It does not work when I put the string into the condition and I don't understand why. Can someone help me?
That doesn't work:
var tmp = 'records.' + j + '.domains';
records.update({'email': '<removed>'}, {'$pull': {tmp: {'_id': req.params.dn}}});
That work:
records.update({'email': '<removed>'}, {'$pull': {'records.1.domain': {'_id': req.params.dn}}});