First steps after MongoDB install

After you’ve completed the mongo database installation then you can start using it.

First, create a database after you log in to database terminal using mongo command:

> mongo
# we need to create a database: 
> use database_name;
# we need to create a user in order to access the databaes properly
> db.createUser(
   {
     user: "user",
     pwd: "password",
     roles: [ "readWrite", "dbAdmin"]
   }
)

That’s it, now you can use it an do whatever you what with your database because you are in full control. https://docs.mongodb.com/manual/reference/method/db.createUser/

You can also create a user without any writes and you can alter them after.

Share This:

Get The Best Of All Posts Delivered To Your Inbox

Subscribe to our newsletter and stay updated.