Answers for "create database mongodb user"

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 create database with username and password

use mydb
db.createUser(
   {
     user: "myuser",
     pwd: "mypassword",
     roles: [ "dbOwner" ]
   }
)
Posted by: Guest on September-04-2021

Code answers related to "create database mongodb user"

Code answers related to "Javascript"

Browse Popular Code Answers by Language