【发布时间】:2014-05-25 12:38:12
【问题描述】:
我正在尝试按某种顺序从集合中获取数据:
db.data.aggregate([
{$limit: 1000},
{$group: {
_id: "$service",
count: {$sum: 1},
data: {$push: '$$ROOT'}
}}
]);
但是得到下一个错误:
Error("Printing Stack Trace")@:0
()@src/mongo/shell/utils.js:37
([object Array])@src/mongo/shell/collection.js:866
@(shell):6
uncaught exception: aggregate failed: {
"errmsg" : "exception: FieldPath field names may not start with '$'.",
"code" : 16410,
"ok" : 0
}
我哪里做错了?
【问题讨论】:
-
您实际使用的是 2.6 版本吗?它刚刚发布,因此文档现在反映了最新版本。
标签: mongodb aggregation-framework