Database – It is a set of collections.
If you do a little research to find out how to create a database in MongoDB, you’ll find documentation for the function “db.createCollection()”. This is actually how you create a database, but it’s referred to as a collection in NoSQL.
To create a MongoDB database:
-“Use” the database.
-Create a collection in the database.
-Verify that you got what you wanted.
Learn MongoDB by Tekslate - Fastest growing sector in the industry.
Explore Online MongoDB Training and course is aligned with industry needs & developed by industry veterans.
Tekslate will turn you into MongoDB Expert.
Assume you have installed MongoDB successfully in your system. Go to the terminal (ctrl + Alt + T) and type mongo and press enter. It opens up a mongo shell.
MongoDB shell version: 2.4.6
Connecting to: test
To check all the database
# show dbs
Let’s insert some records in our emp collection. We have not created any database yet but mongodb creates when record is inserted.
The value is inserted successfully, you can check through find() command.