Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

Latest commit

 

History

History
31 lines (25 loc) · 597 Bytes

README.md

File metadata and controls

31 lines (25 loc) · 597 Bytes

Set-up Database

Create account to connect:

> db.createUser({user: 'username', pwd: 'password', roles: [{role:'readWrite', db:'MY_DB'}, {role: 'read', db:'MY_DB'}]})

then, you will get a response as following:

Successfully added user: {
    "user" : "username",
    "roles" : [
        {
            "role" : "readWrite",
            "db" : "MY_DB"
        },
        {
            "role" : "read",
            "db" : "MY_DB"
        }
    ]
}

and you can connect with server. put your password for connection:

$ mongo mongodb://localhost:27017/MY_DB -u username -p