TypeError: db.addUser is not a function : @(shell):1:1 ——mongoDB创建新用户名密码的方法

不多说,旧版本使用

db.addUser("root","root")

新版本使用这句会出现这个错误提示

TypeError: db.addUser is not a function : @(shell):1:1

新版本用的是

 db.createUser(
  {
    user: "test",
    pwd: "test",
    roles: [ { role: "userAdmin", db: "test" } ]
  }
)
posted @ 2017-12-27 22:26  pyj063  阅读(569)  评论(0编辑  收藏  举报