MongoDB is now extremely used by many popuular Full Stack frameworks such as MEAN.

However for beginners we tend to forgot how to quick start with this NoSQL database.

First, we have to create the admin user. For that we have to go to the “bin” folder under the installation path and run:


Now we are using the shell and we can use the admin database for creating the admin user, just run

use admin

And then run db.createUser (Change the user and pwd at your convinience first :))

    user: "<adminUser>",
    pwd: "<adminPW>",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]

For creating a test database, there is no concept of creating, just use the database directly

use testdb

and again, create a user in there

    user: "<testUser>",
    pwd: "<testPwd>",
    roles: [ { role: "readWrite", db: "testdb" } ]

Leave a Reply

Notify of