Data Migration
This guide teaches you how to migrate data from your Moralis-hosted server to your MongoDB Atlas solution.
Important
The completion of Production Environment Setup is required to continue.
Whitelist your IP in Moralis
In order to access your MongoDB you need to whitelist your IP address:
Connect directly to the hosted Moralis MongoDB
You can connect to the MongoDB that is hosted on Moralis via different methods:
Using scripts
Using the MongoDB Compass tool
Using
mongodump
andmongorestore
Using scripts
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
After you have established direct access to Mongo DB, you You can do your own dumps for the database.
_User table is a particular example of table that starts with _, most of the tables will not start with _
Using Compass
You can use Compass to interact with MongoDB using a tool with an interface.
Now you are connected to the MongoDB that is hosted on Moralis. For reference on how to export data, see https://www.mongodb.com/docs/compass/current/import-export/.
Using mongodump and mongorestore
mongodump
and mongorestore
are command line tools you can use to perform a full database migration from your hosted server to your self-hosted server.
Install MongoDB Database Tools. You can read the instructions specific to your OS here.
Run the following command to dump your hosted server's database:
You should have a folder called dump
with a folder called parse
inside it.
Change the terminal's directory to
dump
.Run the following command to migrate the data to your new MongoDB database - this will copy the data from the
parse
folder to a database calledparse
(/parse
):
Import data
To import data, you can use the same methods as in the previous step. You can use a script, or connect via Compass, or use mongorestore. The difference is that you will need to provide the DATABASE_URI
of your server that you have specified in your .env
.
Last updated