Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-3987

Comment on: "manual/tutorial/add-user-to-database.txt"

      When adding a user to multiple databases, use unique username-and-password combinations for each database

      While this sentence is true for itself, it may lead to the conclusion that a user who needs to access different databases has to be added to each database individually.
      However, it's recommended to add such an user only once by giving him/her multiple roles for all the databases he/she needs to access.
      For example:

      {
        _id: "home.Kari",
        user: "Kari",
        db: "home",
        credentials: { "MONGODB-CR" :"<hashed password>" },
        roles : [
                  { role: "read", db: "home" },
                  { role: "readWrite", db: "test" },
                  { role: "appUser", db: "myApp" }
                ],
        customData: { zipCode: "64157" }
      }

      This user has been added only once to the home database having access to the three databases home, test and myApp.
      See: http://docs.mongodb.org/manual/reference/system-users-collection/

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            kay.agahd@idealo.de Kay Agahd
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              9 years, 29 weeks ago