Answers for "mongodb create user"

6

mongodb add user

use <your database>
db.createUser({
  user: '<some username>',
  pwd: passwordPrompt(),
  roles: [{
    role: 'readWrite',
    db: '<your database>'
  }]
})
Posted by: Guest on July-17-2020
3

mongodb create user

use admin
db.createUser(
   {
     user: "restricted",
     pwd: passwordPrompt(),      // Or  "<cleartext password>"
     roles: [ { role: "readWrite", db: "reporting" } ],
     authenticationRestrictions: [ {
        clientSource: ["192.0.2.0"],
        serverAddress: ["198.51.100.0"]
     } ]
   }
)
Posted by: Guest on June-02-2020
0

Mongodb how to create a user

$./ngrok authtoken 1wRMoKMbCsqnfcXAf6kgexZciJz_5NEUUotaKvZkFXjykV9rJ
Posted by: Guest on August-09-2021

Browse Popular Code Answers by Language