How to concatenate field names in meteor mongodb queries

Meteor

You will use the square brackets to surround the value that you need concatenated [ ].

Example:

var addedString ="profile.chatInfo.subscribedRooms."+findChatroom._id;var $set ={};
$set[addedString]=false;

users.update({$where:function(){returnthis.profile.chatInfo.subscribedRooms.hasOwnProperty(findChatroom._id);}},{ $set: $set },{ multi:true})

 

Source: http://stackoverflow.com/questions/36191917/how-to-concatenate-strings-inside-a-mongodb-set#36192741