Skip to content
K.-Michael Aye edited this page Apr 15, 2015 · 1 revision

Importing a Mongo database

This text was motivated by the tutorials by Chris Snyder(private link) and instructions by Kyle Willet

I am working exclusively with Python, so my instructions are targeted and working for that.

1. run a mongod session on your local machine

The anaconda environment of Continuum.io offers all required packages for this. If you have a basic install, even with pymongo, the Python Mongo DB interface installed, you might still have not yet the mongo database installed itself (at least that happened to me), but the conda command can do that for you as well:

conda install mongodb

Now create a folder where you want to save the Mongo database and launch it with

mongod --db-path path_to_db_folder

2. Feed Mongo dump into the Mongo db server

Run mongorestore on all three BSON collection files (planet_four_classifications, planet_four_subjects, planet_four_users). Example:

mongorestore --db planet_four --drop --collection planet_four_users planet_four_users.bson

with the last file being one of the files in a complete Mongo DB dump for PlanetFour. Note that up to today (2015-03-31) it seems that the Mongo DB dump was incomplete, not containing .bson files, but Chris fixed that one for me today and I was able to execute mongorestore.