In my webservice I was passing array of strings and then I was parsing it like this:
var users = req.body.users;
if (users) {
var user = users.split(',');
query.$and.push({"device_id": {$nin: user}});
}
but now my requirement changed and instead of strings I'm passing array like this:
"users": (
{
"device_id" = "XXX";
"display_name" = XXX;
"facebook_username" = XXX;
username = XXX;
},
{
"device_id" = "YYY";
"display_name" = YYY;
"facebook_username" = YYY;
username = YYY;
}
)
like before - I want to filter out all records that contain given device_ids. How can I modify my code so that it iterates over array (and take into consideration specific fields) instead of strings?