Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Establish a connection to MongoDB via mongo CLI - See Connect to MongoDB with mongo CLI

  2. Switch to admin db with use admin

    No Format
    > use admin
    switched to db admin
  3. Use db.getUsers() to list existing users

    No Format
    > db.getUsers()
    [
            {
                    "_id" : "admin.bvq",
                    "user" : "bvq",
                    "db" : "admin",
                    "roles" : [
                            {
                                    "role" : "root",
                                    "db" : "admin"
                            }
                    ]
            }
    ]

    See https://docs.mongodb.com/v3.4/core/security-built-in-roles/ for available roles in MongoDB