Problem w/ restaurants import

Following lesson 3.1, I’m getting an error trying to import restaurants.json:

###########################################################

mongoimport -d m201 -c restaurants --drop restaurants.json

2019-11-05T13:05:46.978-0600 connected to: mongodb://localhost/

2019-11-05T13:05:46.978-0600 dropping: m201.restaurants

2019-11-05T13:05:46.980-0600 Failed: error processing document #1: invalid character ‘\x00’ looking for beginning of value

2019-11-05T13:05:46.980-0600 0 document(s) imported successfully. 0 document(s) failed to import.

###########################################################

Any help would be appreciated…thanks!

What OS are you using?

The question from 007 is very reasonable. This looks like line ending character of the json file. I do not know how big is that file but I would try to open it in a text editor and change line ending

1 Like

Hi @nrmdmcg,

Few things to check here:

  1. Make sure you have not updated the restaurant.json file by mistake. If so, then delete the file and download it again.
  2. You can also try using --jsonArray in the mongoimport statement:
mongoimport --db dbName --collection collectionName --file fileName.json --jsonArray

Check the documentation link:
https://docs.mongodb.com/manual/reference/program/mongoimport/#cmdoption-mongoimport-jsonarray

Please share the details of OS and the MongoDB version that you are using.

Thanks,
Sonali

Something must have gone awry in the download process; re-downloading solved the issue.

Sorry for the bother, but thanks for the help =)

1 Like