首页 > 数据库技术 > 详细

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

时间:2017-12-27 23:19:34      阅读:756      评论:0      收藏:0      [点我收藏+]

不多说,旧版本使用

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

原文:https://www.cnblogs.com/pyj63/p/8127950.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!