Tag Archives: The user

Mongodb (version 3.2) create user error addUser is not a function

When creating a user from the MongoDB command line, the following error is reported:
db.addUser(“lisi”,”123456″);
2016-11-04T19:41:02.563+0800 E QUERY [thread1] TypeError: db.addUser is not a function:

The addUser() method is no longer supported in the mongdb3.x version and is replaced by the createUser() method.

See the section on creating users in the official documentation:
https://docs.mongodb.com/manual/reference/method/js-user-management/

When you add a new user, you can specify the user’s role. Refer to the built-in roles section of the official documentation:
http://docs.mongoing.com/manual-zh/reference/built-in-roles.html
http://www.cnblogs.com/SamOk/p/5162767.html (with Chinese translation)

Also refer to the blog post:
http://blog.csdn.net/unixpro/article/details/47302855