Before you can write MongoDB queries and inject some data, first you must connect to MongoDB, so open a terminal and type the following:
$ mongo
Then you can list the databases that you have in the MongoDB system:
> show dbs
You should get the following output:
admin 0.000GB
config 0.000GB
These two databases (admin and config) are the default ones from MongoDB. However, we should create new databases according to our needs and purposes.
Creating a database
As soon as you have logged in the MongoDB shell, you can create a fresh database in MongoDB by using the use command:
> use nuxt-app
You should get the following result:
switched to db nuxt-app
However, note that it is the same when you want to select an existing database:
> use admin
You should get the following result:
switched to db admin
If you want to drop a database, first select the database using the use command, for example, use nuxt-app, followed by the dropDatabase function:
> db...