I am using the following Publication to aggregate active trials for my product:
Meteor.publish('pruebasActivas', function() {
var pruebasActivas = Clientes.aggregate([
{
$match: {
'saldoPrueba': {
'$gt': 0
}
}
}, {
$group: {
_id: {
id: '$_id',
cliente: '$cliente'
},
totalPruebas: {
$sum: '$saldoPrueba'
}
}
}
]);
});
if (pruebasActivas && pruebasActivas.length > 0 && pruebasActivas[0]) {
return this.added('aggregate3', 'dashboard.pruebasActivas', pruebasActivas);
}
Which throws the following object as a result
{
"0": {
"_id": {
"id": "YByiuMoJ3shBfTyYQ",
"cliente": "Foo"
},
"totalPruebas": 30000
},
"1": {
"_id": {
"id": "6AHsPAHZhbP3fCBBE",
"cliente": "Foo 2"
},
"totalPruebas": 20000
},
"_id": "dashboard.pruebasActivas"
}
Using Blaze how can I iterate over this Array with Objects in order to get "cliente" and "totalPruebas" to show?