在MongoDB 4.0.12版上运行以下聚合命令时,出现以下错误。从我对错误的了解中,它看起来像是一个语法问题。但这是某人给我的,他们说这可行。有人可以告诉我我在做什么错吗?
db.bookings.aggregate( [ { $planCacheStats: { } } ] )
db.bookings.aggregate( [ { $planCacheStats: { } } , { $project: {createdFromQuery: 1, queryHash: 1 } } ] )
输出:
E QUERY [js] Error: command failed: {
"ok" : 0,
"errmsg" : "Unrecognized pipeline stage name: '$planCacheStats'",
"code" : 40324,
"codeName" : "Location40324"
} : aggregate failed :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:18:14
_assertCommandWorked@src/mongo/shell/assert.js:536:17
assert.commandWorked@src/mongo/shell/assert.js:620:16
DB.prototype._runAggregate@src/mongo/shell/db.js:260:9
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1062:12
@(shell):1:1
答案 0 :(得分:1)