Importing JSON file to MongoLab

Using Mac OS and what I did on terminal.

$ set MONGO_USER=user_name

$ mongoimport -h ds040000.mlab.com:40000 -d race_resultsjson -c race_results -u username -p password –file directory_path/race_results.json

The results are:

connected to: ds040000.mlab.com:40000

Failed: error unmarshaling bytes on document #0: JSON decoder out of sync – data changing underfoot?

Imported 0 documents

However, when I encapsulate the complete array within a single object(see the attached screenshot below) importing the Json file works.

Link about how arrays work in mongodb

http://blog.mlab.com/2013/04/thinking-about-arrays-in-mongodb/

screen-shot-2016-10-04-at-1-22-32-pm

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s