database - 无法识别的管道阶段名称:'$planCacheStats'
问题描述
当我在 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
解决方案
推荐阅读
- python - 提前停止 val_loss 未在 k 折交叉验证中重置
- python - 每次我从选项中点击配置 IDLE 时,Python 3.10 IDLE 都不响应
- javascript - React Light 代码编辑器与选项卡有问题
- django - 不使用 pip 更新 django
- reactjs - 如何更新 Seq 中的项目?
- css - css 属性注释中的感叹号导致它被识别为活动
- python - 如何正确添加 ssh 密钥
- flutter - 如何更改文件路径并将其保存到图库
- testng - 获取 Scenario Context- cucumber pico 容器的空值
- java - 如何在 MongoDB Java 中插入具有随机字段和固定字段的对象?