MongoDB Create DB
Learn all about MongoDB Create DB in this comprehensive tutorial.
- •To create a database in MongoDB, start by creating a MongoClient object, then specify a connection URL with the correct ip address and the name of the database you want to create.
- •You can check if a database exist by listing all databases in you system:
Creating a Database
To create a database in MongoDB, start by creating a MongoClient object, then specify a connection URL with the correct ip address and the name of the database you want to create.
MongoDB will create the database if it does not exist, and make a connection to it.
MongoDB waits until you have created a collection (table), with at least one document (record) before it actually creates the database (and collection).
Check if Database Exists
You can check if a database exist by listing all databases in you system:
Or you can check a specific database by name:
Module quiz
2 questionsWhich of the following is true about MongoDB Create DB?
What is the most common pitfall when working with MongoDB Create DB?
Answer all questions to submit.