db.collectionName.aggregate({"$unwind": "$nestedArrayColumnName"}, {"$match": {"columnWhereCond": arr[i]}}, {"$project": {"_id": 0, "columnToGet": 1}}, function(err2, rows) {
for (var i = 0; i < rows.length; i++) {
var obj = rows[i];
for (var key in obj)
{
var attrName = key;
var attrValue = obj[key];
columnVal = attrValue['name'];
}
}
});
for (var i = 0; i < rows.length; i++) {
var obj = rows[i];
for (var key in obj)
{
var attrName = key;
var attrValue = obj[key];
columnVal = attrValue['name'];
}
}
});