【发布时间】:2016-04-25 15:35:37
【问题描述】:
您好,我使用的是 mongoDB 2.6.11
查询是:
db.companies.aggregate( [
{ $match: { founded_year: { $eq: 2004 },
"funding_rounds.raised_amount": {$ne: null},
funding_rounds: { $size: 5 } } },
{ $project: { name:1,
_id:0,
avg: { $avg: "$funding_rounds.raised_amount" }} },
{ $sort: { avg: -1 } }
] );
但它给出了错误:
Error("Printing Stack Trace")@:0 ()@src/mongo/shell/utils.js:37 ([object Array])@src/mongo/shell/collection.js:866 @(shell):8 uncaught exception: aggregate failed: { "errmsg" : "exception: invalid operator '$avg'", "code" : 15999, "ok" : 0 }
我在 robomongo 上运行此查询?
【问题讨论】:
标签: mongodb