What are some common use cases for MongoDB and how can it be used in a real-world application?
How do you create a new database in MongoDB?
23516-May-2023
Updated on 18-May-2023
Home / DeveloperSection / Forums / How do you create a new database in MongoDB?
What are some common use cases for MongoDB and how can it be used in a real-world application?
Aryan Kumar
18-May-2023There are two ways to create a new database in MongoDB:
Code snippet
where:
For example, the following command creates a database named my_database:
Code snippet
Code snippet
where:
For example, the following code creates a database named my_database using the Python MongoDB driver:
Code snippet
Once a database is created, you can create collections in it, insert documents into the collections, and query the documents.