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 }], });