MongoDB is a Popular NoSQL Database That Utilizes a Document Model
MongoDB is a Popular NoSQL Database That Utilizes a Document Model
Connect to your MongoDB server using the MongoDB shell or a MongoDB driver.
Use the use command to specify the name of the database you want to create.
If the database does not exist, it will be created.
For example, to create a database named my_database, in MongoDB basics you would use
the following command:
use my_database
MongoDB Collections
A collection is a group of related documents stored in the same database. It can be thought of
as a table in a relational database but with a more flexible schema design.
In MongoDB basics, collections are created automatically when you insert the first document
into them, or you can create them explicitly using the createCollection() method.
To create a collection in MongoDB basics, you can use the following steps:
Connect to your MongoDB server using the MongoDB shell or a MongoDB driver.
Use the db.createCollection() method to specify the name of the collection you want to
create.
If the collection does not exist, it will be created.
For example, to create a collection named my_collection in the my_database database, you
would use the following command:
db.my_database.createCollection("my_collection")