Copying MongoDB from

I started deploying my latest Meteor app to my own VPS and wanted to use the data from my beta system hosted at
First of all, I was surprised how simple and easy it was to deploy using Meteor Up (MUP). Some weeks before, I spend an entire day on installing the Meteor environment on a Debian machine – now it’s less than 15 minutes! One caveat though, it did not work for me on Debian, I had to drop my previous Debian VM and replaced it with Ubuntu as MUP depends on Upstart and it seems rather tricky to replace Debian’s SysVinit with Upstart. Ok, different story, but a biiig thanks to Arunoda for the great work on MUP!!

So, how to db.copyDatabase(); the data from the original DB to yours?

The method signature is db.copyDatabase("[app-name]_meteor_com", "[your-db-name]", "[meteor-mongo-domain]", "[username]", "[password]");
I’ll assume “app” to be the app name for simplicity.
General approach: get the MongoDB URL, extract all the parameters above, log into your own MongoDB installation and use db.CopyDatabase(); to move the data over.

All commands need to be executed on the same machine. (FYI, the username and password get automatically generated and it did not work to get the URL on my machine and use the username and password on the server… strange though)
Thus, install Meteor on your server curl | sh.
Then, get the MongoDB URL meteor mongo --url
It will look like this mongodb://
The parts are

  • username: client-fd532e7d
  • password: 683a9a4e-1604-5729-07fd-df1ba7dcbbf9
  • meteor-mongo-domain:

Start a MongoDB CLI by typing mongo.
In my case, the database created by the app and MUP was called “admin” (i.e. [your-db-name]=”admin”). How to find yours? Use “show dbs” in the MongoDB CLI to see which one is yours.
Then write “use [your-db-name]” to switch to your DB.
And finally, using the data from above: db.copyDatabase("app_meteor_com", "admin", "", "client-2fbeb6ef", "1bd44ece-b3fa-7d1b-0046-83b917927f35");
will copy the data over in a few seconds.
When I tried first, I got an error about a duplicate key (the deployed app had created some data already), dropping the entire DB fixed it. Also, the username and password are valid for a short time only, so maybe having to terminals open is a good idea.

References: Cloning MongoDB, Meteor dump, Clone DB from, Copy DB from one server to another

Leave a Reply

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