Hi there,
Im hoping for some assitance, I have been trying to run and aggregate on my data but im not sure what to do with the result as it returns like so:
Aggregate {
_pipeline: [ { '$group': [Object] } ],
_model: Model { Kids },
options: {} }
I’ve tried to toArray() and forEach it but it says the variable I stored it in is not a function. I’m trying to graph the results. My code below:
const provinces = Kids.aggregate([
{
$group: {
_id: {
province: '$province',
},
count: {
$sum: 1,
},
},
},
]);