Overview

MongoDB has very similar features with RDBMS database. Like any other DB, it can be shutdown and started up for example:

Basic Management

Start/Stop

You can start MongoDB from a file as follows:

Start

Where the script contains:

startMongoDB

and the contents of the configuration file is:

mongo.conf

The database can also be shutdown as follows:

Stop

or you can do it manually using

Set up Terminal Shell

The shell can be set to more readable manner as follows:

Change storage engine

From 4.2 the: MMAPv1 is depricated, so if you are thinking of upgrading to 4.2, we have to change the storage engine. The engine isn't easy though. In nutshell we should:

Perform export

Create new directory for that storage engine (mongo should have read/write).

Edit the mongo configuration file to use the new folder and storage engine.

Restart the mongo with that storage engine.

Restore the export.

Perform export

The export can be done wherever you can, in our case we will create a new directory for that backup:

The export is done very easy:

Modify the mongo config file

We have to modify the config file so it will point to the new folder and with the correct engine:

P.S. Disable the authentication for now, since it will be problem later:

Restart the mongod

Feel free to restart the mongo however you want :)

Restore the export

If the authentication isn't disabled, that will create a problem since in the config file the authentication is enabled, but the user (which is in the admin database in our case) cannot be used. So ensure the authentication is disabled:

Verify the data

We can verify the data, for some reason mongo was showing me 0000, even though there was data in the databases: