-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localhost data migration #78
Comments
@kwe Can you export the data from Parse (you get a zip to download) and then import that into your local mongoDB? The zip won't contain any files uploaded to Parse but will include reference urls. |
There is a way, using a program like |
I did an export, unzipped and then.. Edited each file removing from the first line.. { "results": [ (There may be a more elegant way to do this) - it was needed to avoid ending up with a single document with an embedded "results" array. mongoimport --db dev --collection Health --file Health.json --jsonArray seems to work. i.e. import Health resource into local mongodb |
I tried doing the migration to localhost, and it worked. I was at home, and I could set the router settings with port forwarding for 27101 to my machine. I can then provide my external ip address to the migration tool, and my data get imported. The mongodb connection I used is: mongodb://111.111.111.111:27017/my-db-name I tried ngrok and it doesn't work for me. Hope this helps. |
@kwe I tried importing the data like this this, but I think it isn't stored properly. For example, querying on a given object id doesn't work. The objects that are created through the API are represented like this:
Whereas the objects that are imported from the exported Parse zip file look like this:
|
hmm. I'm new to mongodb - I guess what you're finding would break objects that reference other resources by _id. My relatively simple app works fine, will try with a more complex example. I guess I'd be tempted to globally replace 'objectId' with '_id' and try an import. Don't know if mongodb allows import to include id value like that. |
I created a Python import script that imports objects from Parse-exported JSON files (can parse big files, using the I have three other questions about this importer:
|
Pointers are represented as an object like Indeed, There are lots of special cases, and I'd look at |
@gfosco Thanks! I inspected the code a bit further, and maybe a NodeJS importer would make most sense, based on the existing ExportAdapter.js (create and addRelation methods) and some way to read large JSON files, like https://github.com/dominictarr/JSONStream. What do you think? |
I would suggest against building a custom importer, and instead just use the normal migration process with an internet accessible mongo installation. |
Any word? And does running the migration process unavoidably migrate off of the hosted Parse db, or is that an optional step? |
The finalize button on the migration page will stop all reads and writes to the Parse.com database and begin reading and writing to your own database exclusively. Before you have clicked finalize, you can choose to cancel the migration and start another migration to a different destination. |
KWE's comment on how to populate a Parse database works great. Small error though.... leave the "[" on the first line. |
change to localhost for Heroku one-click deploys
For anyone that stumbles across this later in a search for importing Parse exports to mongodb, what @kwe meant to say was to remove the |
I've Mongodb, Parse server running locally - Is there a way to import the data without going through the need to make my development DB available on the internet so that Parse can connect. This is purely to test the setup prior to a formal migration..
The text was updated successfully, but these errors were encountered: