Hello,
I’m trying to implement a group by query using agregate.
Here is the query :
db['cfs.medias.filerecord'].aggregate(
[
{
$project:
{
year: { $year: "$uploadedAt" },
month: { $month: "$uploadedAt" },
day: { $dayOfMonth: "$uploadedAt" },
hour: { $hour: "$uploadedAt" },
minutes: { $minute: "$uploadedAt" },
seconds: { $second: "$uploadedAt" },
milliseconds: { $millisecond: "$uploadedAt" },
dayOfYear: { $dayOfYear: "$uploadedAt" },
dayOfWeek: { $dayOfWeek: "$uploadedAt" },
week: { $week: "$uploadedAt" }
}
},
{ "$group" :
{ "_id" : {
"year" : "$year",
"month" : "$month",
"day" : "$day"
},
"medias": {
"$push": {id:"$_id"}
}
}
}
]
);
I’d like to push the current document inside the medias Array instead of its id. How would one do that with mongo 2.4? As far as I know meteor does not support mongo 3. nore 2.6 ?
Thanks a lot !
Gabriel