[DOCS-8133] Comment on: "manual/tutorial/enable-authentication.txt" Created: 20/Jun/16 Updated: 03/Nov/17 Resolved: 05/Oct/16 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 01112017-cleanup |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Docs Collector User (Inactive) | Assignee: | Ravind Kumar (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | collector-298ba4e7 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Debian 7, MongoDB 2.4.10 Location: https://docs.mongodb.com/manual/tutorial/enable-authentication/ |
||
| Participants: | |
| Days since reply: | 7 years, 34 weeks, 2 days ago |
| Description |
|
The information is outdated. I wasted long time trying to figure out and googling to find out that method "createUser" is deprecated and replaced by "addUser", as well as the format for roles (plain strings). |
| Comments |
| Comment by Ravind Kumar (Inactive) [ 20/Jun/16 ] | |||||||||||
|
Hello, db.createUser() is the currently supported method for adding users to a MongoDB database. It is possible that you are viewing an old or outdated page. If you found this information through a third-party website, it is possible the information is outdated or wrong. The addUser() method has been deprecated since MongoDB 2.6. When you use plain strings to specify the built-in roles in 2.6+, it defaults to the database in use. To specify a database to add a role to, you can pass a document to the roles array as documented in createUser(). For MongoDB versions 2.6+, you can create users with db.createUser(), as in the following example:
This creates a user with clusterAdmin role on the admin database, readAnyDatabase role on the admin database, and readWrite role on the products database. I hope this answers your question. |