MongoDB stores data in a Database → Collection → Document structure.
Database → Like a container for collections (similar to a database in SQL).
Collection → Like a table in SQL, it contains multiple documents.
Document → A JSON-like object that stores actual data.

Create a Database
use database_name
If myDatabase
doesn’t exist, it will create a new database.
For checking the current database:
db
To show all databases:
show dbs

Create a Collection
db.createCollection("collection_name") // syntax db.createCollection("students")
This will create an empty collection named students.
To view collections in the current DB:
show collections
The post MongoDB Create Datbases and Collections appeared first on PHPGurukul.
Source: Read MoreÂ