我试图通过使用https://stackoverflow.com/a/23116396/2806163上建议的命令来获取集合collectionUID
中按字段status
分组的条目数
集合中的
样本响应:
{“ _id”:ObjectId(“ b .... 5”),“ status”:“处理中”,“ product_id”: “ a ... 2”,“目标”:{},...,“ request_id”:“ b ... d”,“时间戳” :“ 1536028784.0797083”,“ userID”:“ Daksh”}
错误: TypeError: cmd.cursor is undefined
> db.collectionUID.aggregate([
... {"$group" : {_id:"$status", count:{$sum:1}}}
... ])
2018-09-18T18:57:41.983+0530 E QUERY [thread1] TypeError: cmd.cursor is undefined :
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1322:1
@(shell):1:1
>
PS: mongo --version: MongoDB shell版本v3.4.10-4-g67ee356c6b