【发布时间】:2016-04-10 14:18:15
【问题描述】:
所以我正在使用mongo开发一个项目,执行代码后出现错误:
db.usercollection.insert({ "username" : "testuser1", "email" : "testuser1@testdomain.com" })
显示的错误是:
Cannot use 'commands' readMode, degrading to 'legacy' mode WriteResult({
"writeError" : {
"code" : 13,
"errmsg" : "not authorized on watersheds to execute command { insert: \"usercollection\", documents: [ { _id: ObjectId('568d0eda45d472b121116bef'), username: \"testuser1\", email: \"testuser1@testdomain.com\" } ], ordered: true }"
} })
db.version() 是 3.0.7,我安装的 MongoDB shell 版本是 3.2.0
我应该如何解决这个问题?
问候, 达里尔
【问题讨论】:
-
重启 mongo shell 并发出 db.getMongo().forceReadMode("legacy") 或 db.getMongo().forceReadMode("compatibility") 命令。
-
您的 shell 和 DB 版本可能不一样。 stackoverflow.com/questions/24916320/…
标签: mongodb mongo-shell