// Create the database database by switching to it
db = db.getSiblingDB('database');
// Create a test collection to ensure the database is created
// (MongoDB only creates a database when it has content)
db.createCollection('collection');
// Create the user with the specified credentials
db.createUser({
user: "admin",
pwd: "Pass",
roles: [
{ role: "readWrite", db: "database" },
{ role: "dbAdmin", db: "database" }
]
})
})
No hay comentarios:
Publicar un comentario