annalexc / space-rocks

1 stars 0 forks source link

Help with using mongoimport in heroku #6

Closed annalexc closed 8 years ago

annalexc commented 8 years ago

Long line of asteroids waiting outside of the Heroku club waiting to get in, and I'm not a good bouncer. 😧

rapala61 commented 8 years ago

It's very close to how you do it in your own computer, you just have to tell mongo where on the webz it should import instead of your local database. Read this documentation: http://docs.mlab.com/migrating/#import-and-export . The correct credentials should be available to you in the mLabs dashboard of your app.

You get there by:

  1. going to heroku.com.
  2. selecting your app in your dashboard.
  3. click on the mLab MongoDB link inside the "add-ons" section of your app's dashboard. (You will be taken to the mLabs add-on dashboard for that app) 4.click on the Tools tab and you will see templates of the commands you need to import your JSON to your heroku add-on database.
annalexc commented 8 years ago

Hi Rafa, I'm able to connect the database and run the appropriate mongoimport command, however I'm getting this error:

$ mongoimport -h ds015403.mlab.com:15403 -d heroku_6cjh1kvm -c asteroids -u heroku_6cjh1kvm -p 6r7vdev6psn0ibjv4583abhjt5 --file data/neos-by-year.json
2016-06-03T15:24:43.791-0400    connected to: ds015403.mlab.com:15403
2016-06-03T15:24:43.835-0400    Failed: error unmarshaling bytes on document #0: JSON decoder out of sync - data changing underfoot?
2016-06-03T15:24:43.835-0400    imported 0 documents
$ 
annalexc commented 8 years ago

fixed my command to include --jsonArray and was able to import, though my laptop had a conniption in the process. Thanks for the help!

andrewlvovsky commented 3 years ago

Hi @annalexc ,

I am having a similar issue with trying to run mongoimport on a Heroku deployment. Do you remember the steps you followed? mLab has been deprecated and MongoDB Atlas seemed to replace it, but there doesn't appear to be a new add-on for it just yet.

Any help would be appreciated. Thanks!

mughalz commented 3 years ago

hi @borninla did you find solution to your problem, if so would be nice if you can share it please? I am trying to deploy a project which has mongoDB as a backend, nodejs and typescript