Migrating your MongoDB to another Mongo Host
Checking what version of Mongo you are using:
The version of mongo being used for your database can be found on the individual database web dashboard. Check the ‘administration’ tab and the mongo version, region, and IaaS (AWS, Joyent) will be shown.
The default page shown when you log in to the web dashboard at https://my.xervo.io will be your project list. Select the ‘databases tab’ to the left.
On the database page of the dashboard you will see a list of all the databases on your account.
Select the database you are migrating.
Once you’ve selected your database, you will be taken to that individual database dashboard.
Select the ‘administration’ tab. Here you will see your mongo version etc.
Migrating the database to a new host
Make sure you have at least version 7.1.1 of Xervo CLI installed to migrate your database.
Installing the Xervo CLI:
$ npm install -g @xervo/cli
$ xervo --version
After you’ve installed the latest CLI in your terminal you can use the migrate command.
$ xervo mongo migrate
You will be shown a list of databases that you can migrate and the hosts which you can transfer the database to. (You do not have to create a new database before performing the migration.)
The database will be cloned to the new host and the option to create a user on this new database is presented. Make sure to say ‘no’ to the ‘read only permissions?’ input. Most apps require a database user with Read + Write (R+W) permissions.
After this you have the option to change the MONGO_URL environment variable on a project of your selection. You may want to test this out on a staging project before adding the env var to your production application/project.
Select the project number you wish to change / update, and then restart that project for the change to take effect.
Deleting a Mongo Database
Deleting a mongo database must be done from the web dashboard.
Do not delete your database before attempting to migrate that database.
After you’ve migrated your database, the old database will still exist.
Proceed to the database web dashboard as you did before to find the database version.
In the screen snip below you will see the newly created database, and the older database that was cloned.
You can tell which database is older database (that you cloned from) by looking at the ‘Created on’ text right below the database name.
Select the database name that has an older ‘Created on’ date, and then select the administration section of the database dashboard. From there you can delete the database.