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 issue,Restart MongoDB in a non-auth mannerMongod--dbpath=/opt/mongodb/data--logpath=/opt/mongodb/logs/mongodb.log-port=27017--fork (Note:To be auth, 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 userReference:http://docs.mongodb.org/manual/reference/method/db.createUser/#create-administrative-user-with-roles
DB.CreateUser( { User: "Accountuser", pwd: "Password", Roles: [ "ReadWrite", "DbAdmin" ] })
#
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MongoDB Add user in v3.0 Problem Resolution (property ' AddUser ' of object Admin was not a func)