当前位置:Gxlcms > 数据库问题 > TypeError: db.addUser is not a function : @(shell):1:1 ——mongoDB创建新用户名密码的方法

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

时间:2021-07-01 10:21:17 帮助过:6人阅读

不多说,旧版本使用

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创建新用户名密码的方法

标签:nbsp   class   技术分享   info   创建   bsp   pos   mongo   div   

人气教程排行