MongoDB Add user in v3.0 Problem Resolution (property ' AddUser ' of object Admin was not a func)

Source: Internet
Author: User
Tags auth mongodb mongodb add
MongoDB Add user in v3.0 Problem Resolution (property ' AddUser ' of object Admin was not a func) # problem: An error occurred while creating a MongoDB account> Db.adduser (' Jyu ', ' aerohive ') 2015-08-05t20:03:02.767+0800 E QUERY typeerror:property ' addUser ' of object admin is not a function
#步骤1:At first, I thought it was a privilege problem to restart MongoDB Mongod--dbpath=/opt/mongodb/data in a non-auth manner--logpath=/opt/mongodb/logs/mongodb.log-port=27017 --fork (Note: Auth is required, the start command is: Mongod--dbpath=/opt/mongodb/data--logpath=/opt/mongodb/logs/mongodb.log--auth--port= 27017--fork) #步骤2:Still prompt error, and then find the reason, originally V3 version MongoDB has no longer use adduser, but adopted the Db.createuser
#最终解决方案:Use this method to increase the user's reference:
Db.createuser (
     User: "Accountuser",
     pwd: "Password",
     roles: ["ReadWrite", "DbAdmin"]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.