码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2017-12-27 23:54:31      阅读:364      评论:0      收藏:0      [点我收藏+]

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

不多说,旧版本使用

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   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!