In MongoDB, we can manually create a collection, but creating a database is an automatic task in MongoDB. This is a distinguished feature in MongoDB, unlike the SQL databases where creating a database is a manual task. A database is automatically created when a value is saved into the defined collection at first time.
- Type the command use DATABASE_NAME in the command prompt to create a new database or to select the already created database with the respective name.
For Example: use Hellodb
- Type the command db in the command prompt to check the currently selected database.
- Type the command show dbs in the command prompt to check the database list.