Creating a database
Let's start by defining the database that we are going to work with. In your shell, execute the following:
> use OrderBase
This will ask MongoDB to switch to a new database, called OrderBase
, that we wish to run the commands against. The response will be as follows:
switched to db OrderBase
But wait, how can we switch to a database that does not exist yet? MongoDB flexibility to the rescue! When you tell MongoDB to use a database, it will create that database for you automatically before switching to it.