How to migrate Parse DB to self-hosted MongoDB?

Parse, a back-end service provider for mobile applications, has officially announced its retirement and will be completely phasing out its deployment on January 28, 2017. Unfortunately, this might be one the worst nightmares for SMEs who very much rely on Parse Server. Turning out to be an open source platform, Parse Server lets you to switch the Parse API to any infrastructure or data base which can host Node.js applications.

Following is a migration guide on how to migrate Parse DB to self-hosted MongoDB.

Node >=4.3
MongoDB version 2.6.X or 3.0.X
Python 2.x (For Windows users, 2.7.1 is the required version)
For deployment, an infrastructure provider like Heroku or AWS

Migrate Parse DB to Self-Hosted MongoDB
– Using your own MongoDB instance and infrastructure will help ensure that your queries will run at their highest level of performance. By migrating your database, you will be able to:
Backup your entire database periodically and on demand.
– Restore backups.
– Increase performance of queries (and thereby your app) by providing larger amounts of dedicated processing power and memory to your database.
– Eliminate risk of another app impacting the performance of your app’s queries.
– Gain raw access to your application’s data.
– Modify, add, or fine-tune indexes on your most popular or complex queries.

Use the database migration tool to transfer your data from ( App Settings → General → Migrate to external database ). Add your mongodb url in the textbox.

Make sure the url contains admin privileges.

A new collection will be added to your database specified in mongodb url. Make sure it contains all the data as in

Now you can use this collection for further querying.

Set Up Local Parse Server (nodejs and express)
We are using an express application with parse-server module. Earlier the url contains domain name as ‘’, but now we can change it to our own domain name (localhost too).

Create an new express application using express generator if you didn’t have any express application. Make sure the nodejs version is >=4.3

Follow the below steps:
1. Install parse-server module using npm (version >=2.1.4)
npm install -g parse-server
2. Create a new folder named ’cloud’ in the root directory. Add a new file ‘main.js’ to this folder. This file will contain all the parse defined functions.
3. Create an instance of Parse Server in your server file (app.js)
var api = new ParseServer({
databaseURI: ‘<mongodb://your.mongo.uri>’,
appId: ”,
fileKey: ”,
masterKey: ”,
serverURL: ‘http://localhost:1337/parse’
4. If you are using Parse Hosting, you can migrate all these web endpoints to the same Express app that is serving Parse Server. For example, you could mount Parse Server under /parse and your website at the root, like so:
app.use(‘/parse’, api);
So that all the parse defined functions will be loaded in the url with ‘http://localhost:1337/parse’.
5. We will now migrate your existing Cloud Code to run in Parse Server. Copy your app’s Cloud Code to the application ‘cloud/main.js’

A sample function is given below:

Parse.Cloud.define(“list”, function(request, response) {
var query = new Parse.Query(‘TableName’)
error: function(err) {
success: function(res) {
This will list all the data inside the collection ‘TableName’

6. Now the express app is all set to run the parse query.
Run the application ‘http://localhost:1337’ in browser and check whether its
7. Run the query
curl -X POST -H “X-Parse-Application-Id: YOUR_APP_ID” \
8. Now you will see the list of data inside the collection.


I hope this blog provides you an idea about migrating Parse DB to self-hosted MongoDB. If you are struggling with Parse DB migration or you want to migrate to AWS or any other data base or cloud server, shoot an inquiry right away to our most expert architect, Jerry Don, at [email protected].

Latest stories

  • How Kerala’s IT Sector Braces To Fight COVID-19?

    In India and around the world, the impact of the coronavirus pandemic is evident across all sectors of the economy.  With  COVID-19 spreading rapidly around the world, the pandemic has not only affected the lives of hundreds of thousands of people but also demonstrated a growing impact on the global economy. From companies chalking out […]

  • How a DevOps Approach Helps To Meet Deadlines Every Time ?

    Missing a deadline never feels good!  Despite designing perfect workflows from start to finish, we often found our teams chasing deadlines until the very last moment. This upsetting trend led us to a quest to find out what obstacles prevented our teams from getting work over the finish line in time. The biggest factors contributing […]

  • Can You Fuel The Next Wave of Business Growth During a Pandemic?

    Pandemics and economic recessions are known to create disruptive effects on global economies and businesses. For e.g, the Black Death was a devastating bubonic plague that arrived in Europe during 1347. The catastrophe resulted in the collapse of the feudal system in Europe while replacing it with a more modern employment contract.  Covid-19 pandemic has […]

Leave a Reply

Your email address will not be published. Required fields are marked *