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

2023-05-25,,

不多说,旧版本使用

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" } ]
  }
)

TypeError: db.addUser is not a function : @(shell):1:1 ——mongoDB创建用户名密码的方法的相关教程结束。

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

下载本文的Word格式文档,以方便收藏与打印。