Importing JSON file to MongoLab

Using Mac OS and what I did on terminal.

$ set MONGO_USER=user_name

$ mongoimport -h -d race_resultsjson -c race_results -u username -p password –file directory_path/race_results.json

The results are:

connected to:

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




Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s