Create root user

use admin
db.createUser({ user: 'root', pwd: 'root', roles: ['root'] })
db.auth('root', 'root')

Create DB-specified user

use exampledb
db.createUser({ user: 'exampledb', pwd: 'exampledb', roles: [ { role: 'dbOwner', db: 'exampledb' } ] })
db.auth('exampledb', 'exampledb')