我有this table和以下查询:
db.collection.aggregate([
{
$group: {
_id: {
$toLower: "$firm.status"
},
count: {
$sum: 1
}
}
}
])
我想要获得的结果是:
{
"incomplete": 1,
"pending": 2,
"complete": 1
}
但是我得到的结果是:
[
{
"_id": "incomplete",
"count": 1
},
{
"_id": "complete",
"count": 1
},
{
"_id": "pending",
"count": 2
}
]
如何修改查询以获得我想要的东西?谢谢您的时间!