問題描述
命令失敗:MongoError:CMD_NOT_ALLOWED:配置文件 (command failed: MongoError: CMD_NOT_ALLOWED: profile)
我正在使用 Atlas free 集群 mongodb 並嘗試啟用分析器以進行監控,並且我在集群上有 Atlas Admin 訪問權限
在設置中,如上圖所示啟用探查器選項
當我運行命令db.setProfilingLevel(2)
時,出現以下錯誤:
MongoDB Enterprise Cluster0‑shard‑0:PRIMARY> db.setProfilingLevel(2)
2020‑02‑01T11:52:51.976+1100 E QUERY [js] uncaught exception: Error: command failed: {
"ok" : 0,
"errmsg" : "CMD_NOT_ALLOWED: profile",
"code" : 8000,
"codeName" : "AtlasError"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:18:14
_assertCommandWorked@src/mongo/shell/assert.js:583:17
assert.commandWorked@src/mongo/shell/assert.js:673:16
DB.prototype.setProfilingLevel@src/mongo/shell/db.js:681:12
@(shell):1:1
參考解法
方法 1:
Mongodb Atlas free tier blocks profiling options.
You can find operations that are not permitted in Mongodb Atlas free tier below
https://docs.atlas.mongodb.com/reference/unsupported‑commands/