Switch to Other Database
To switch to other database use the command ” use Database_Name” command. If Database does not exists then it will create a new Database.
Switch to other Database Example
The below image shows how to switch to another database using Mongo Shell.
In the above Example, First we check current Database name using db command which was UserDB then we use “use test” command to switch to database test.
References: https://docs.mongodb.com/manual/core/databases-and-collections/#databases
MongoDB – Create Database using Mongo Shell
A MongoDB Database is the container for all the collections, where the Collection is a bunch of MongoDB documents similar to tables in RDBMS and the Document is made up of fields similar to a tuple in RDBMS, but it has a dynamic schema here.
This article explains the easy method to create a Database in MongoDB using Mongo Shell.
Contact Us