Thursday, October 6, 2022

 Custom command


1. connect database mongo localhost mặc định:

     mongosh 

     hoặc
mongosh "mongodb://localhost:27017"


2. tạo các user:
    db.createUser({user: "namlong",pwd: "h23@#Hba",roles: [ { role: "readWrite", db: "namlong" } ]})

    db.createUser({user: "namlongadmin",pwd: "h23@#Hba",roles:[{role: "userAdminAnyDatabase" , db:"admin"}]})

    db.createUser({user: "namlongadmin1",pwd: "h23@#Hba",roles:[{role: "userAdmin" , db:"namlong"}]})


3. connect database bằng user mới tạo:

    mongosh "mongodb://localhost:27017/namlong" --username namlongadmin1 --password h23@#Hba --authenticationDatabase namlong


No comments:

Post a Comment

So sánh các GitFlow model và áp dụng với CICD

https://medium.com/oho-software/so-s%C3%A1nh-c%C3%A1c-gitflow-model-v%C3%A0-%C3%A1p-d%E1%BB%A5ng-v%E1%BB%9Bi-cicd-b6581cfc893a