Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 31 Current »

By default there is only 1 user created during the installation process of BVQ (default name: bvq, role: root). You can modify the user & password in the repository installer within the DB access screen.

This user afterwards is used by the BVQ services & UIs to connect to the database. Whenever you change the password of the user remeber to change it in the other BVQ modules (GUI DB connection profile, etc.)


Connect to MongoDB with mongo CLI

  1. Establish a connection to MongoDB via mongo CLI (use CMD or PowerShell) (see https://docs.mongodb.com/v3.4/reference/program/mongo/)

    mongo --authenticationDatabase admin -u bvq -p Passwort

    (default location of binaries = C:\Program Files\SVA\BVQ\bvq-mongodb\bin, put in PATH variable to access from outside the directory
    change username -u and password -p to your credentials)


List existing users

  1. Establish a connection to MongoDB via mongo CLI (see Connect to MongoDB with mongo CLI)

  2. Switch to admin db with use admin

    > use admin
    switched to db admin
  3. Use db.getUsers() to list existing users (see https://docs.mongodb.com/v3.4/reference/method/db.getUsers/)

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

Create a user

  1. Establish a connection to MongoDB via mongo CLI (see Connect to MongoDB with mongo CLI)

  2. Switch to admin db with use admin

  3. Use db.createUser() to create a new user (see https://docs.mongodb.com/v3.4/reference/method/db.createUser/)

    > db.createUser({user: 'TEST_USER', pwd: 'TEST_PASSWORD', customData: { name: 'NAME OF TESTUSER' }, roles: ['readWriteAnyDatabase']})
    Successfully added user: {
            "user" : "TEST_USER",
            "customData" : {
                    "name" : "NAME OF TESTUSER"
            },
            "roles" : [
                    "readWriteAnyDatabase"
            ]
    }
    >

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


  4. List users with db.getUsers() (see List existing users)

    > db.getUsers()
    [
            {
                    "_id" : "admin.TEST_USER",
                    "user" : "TEST_USER",
                    "db" : "admin",
                    "customData" : {
                            "name" : "NAME OF TESTUSER"
                    },
                    "roles" : [
                            {
                                    "role" : "readWriteAnyDatabase",
                                    "db" : "admin"
                            }
                    ]
            },
            {
                    "_id" : "admin.bvq",
                    "user" : "bvq",
                    "db" : "admin",
                    "roles" : [
                            {
                                    "role" : "root",
                                    "db" : "admin"
                            }
                    ]
            }
    ]
    >

Remove a user

  1. Establish a connection to MongoDB via mongo CLI (see Connect to MongoDB with mongo CLI)

  2. Switch to admin db with use admin

  3. Use db.dropUser() to delete an existing user (see https://docs.mongodb.com/v3.4/reference/method/db.dropUser/)

    > db.dropUser('TEST_USER')
    true
    >
  4. List users with db.getUsers() (see List existing users)

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

    User TEST_USER was deleted successfully (user was created in Create an additional user)

  • No labels