13 lines
259 B
JavaScript
13 lines
259 B
JavaScript
|
const username = 'example_user';
|
||
|
const password = 'example_password';
|
||
|
const dbName = 'example_db';
|
||
|
const userRole = 'readWrite';
|
||
|
|
||
|
db = db.getSiblingDB(dbName);
|
||
|
|
||
|
db.createUser({
|
||
|
user: username,
|
||
|
pwd: password,
|
||
|
roles: [{ role: userRole, db: dbName }],
|
||
|
});
|