In MongoDB's authentication model, a username is scoped to a database, called Authentication Database. The user’s privileges are not necessarily limited to this database. The user can have privileges in additional databases.


If the field is left blank, the default value admin is used.


For authentication methods other than User/Password authentication (like Kerberos, LDAP, X.509) the Authentication Database is always set to $external and no user input is required.



Example

Assuming a procedure as described here but with 'readWrite' rights:


use admin

db.createUser(

 {

   user: "myUserAdmin",

   pwd: "abc123",

   roles: [ { role: "readWrite", db: "admin" } ]

 }

)


Restart the MongoDB instance with access control:

mongod --auth --port 27017 --dbpath /data/db1


To connect to this instance with Hackolade, the settings could be created as follows:

Connection tab:


and Authentication tab: