Musíte použít $dayOfYear
objekt jako hodnotu nového pole ve vašem _id
, takto:
db.builds.aggregate(
{ $group: {
_id: {
build_result: "$build_result",
dayOfYear: { $dayOfYear: "$build_timestamp" }
},
build_duration: { $avg: "$build_duration" }
} }
)
Výstup:
{
"result": [
{
"_id": {
"build_result": "SUCCESS",
"dayOfYear": 15
},
"build_duration": 667075
}
],
"ok": 1
}