Restaurants.json fail to import

I got error when importing restaurants.json using compass on windows 10.


Could you please give me a help ?


Hi @tk_79044 !

I tried the same using Compass on OSX : I had the same error.

Maybe Compass is not the right tool for handling “big” files ? You should try to manage to do it with the shell. MongoDB provide good shell tools like mongoimport.

I imported my data with this command :
mongoimport --authenticationDatabase "admin" -u YOUR_USERNAME -d m201 -c restaurants --drop /shared/restaurants.json

I used vagrant to easily setup a Virtual Machine and a Mongo database, I learnt to do it from M103 course. But if your database is hosted anywhere else (like MongoDB Atlas), you will need more parameters.

You can find mongoimport manual here :

Hope it helps,


@ tk_79044

Interesting. I don’t normally use Compass myself as I prefer to work from the command line and the shell – oldtimer and all that :wink: – but just use the command line tools, so I’d never seen that before. However, I can replicate this error on both my MacOS and Linux systems, so it looks like a real error. I don’t (offhand) know if there’s some built-in limitation on the number of documents Compass can process, but I’ll try to find out. There’s no mention of that in the documentation. I’ll post the answer back here when I have one.

Meanwhile, I’d strongly suggest that you take @ Joris_SAIDANI_37802 suggestion and use mongoimport from the command line to load this file. Good luck.

Maybe is the --jsonArray option to the mongoimport command? I was trying using that flag but it always responding me with:
“Failed: error reading separator after document #1: bad JSON array format - found no opening bracket ‘[’ in input source”

@ Alessandro_04647

I don’t know why you would think that option was appropriate here. According to the mongoimport documentation here, this option is for one specific circumstance

    Use --jsonArray in conjunction with mongoexport --jsonArray.

The default import format for mongoimport is JSON, and the command as shown above works just fine. Compass appears to be the problem.

i was using it because in the previous mongoimport seem work fine with that flag. But now i understand that i was using it in a wrong way.


Hi, someone could import restaurants.json?

@ raranibar_73

Is this a question? If so, please open a new thread and give more details, including what you’re trying to do, and what error message you see. Thanks.


I’ve had the same issue with Compass, and so I’ve been attempting to use mongoimport in the terminal. The command that I run is as follows:

mongoimport --host "<my free Atlas cluster>"  --username <username> --db m201 --collection restaurants --drop restaurants.json

It prompts my for my password, but after, when it attempts to do the import I get the following error:

2019-04-18T09:25:06.346+0100	[........................] m201.restaurants	0B/144MB (0.0%)
2019-04-18T09:25:06.893+0100	[........................] m201.restaurants	0B/144MB (0.0%)
2019-04-18T09:25:06.893+0100	Failed: error connecting to db server: no reachable servers
2019-04-18T09:25:06.893+0100	imported 0 documents

Is there a way to resolve this issue?

Nevermind, I’ve now managed to import it using:

mongoimport --host <HOST> --ssl --username <USERNAME> --password <PASSWORD> --authenticationDatabase admin --db <DATABASE> --collection <COLLECTION> --type <FILETYPE> --file <FILENAME>

The ‘Command Line Tools’ section in Atlas when has a few helpful command line templates like the one above.

The post that opened this string by tk_79044 - shows an error message importing the restaurants.json using the Compass tool into an Atlas cluster. I experience the exact same thing. The people.json file of 50k docs imported ok. The restaurant.json stops at 32.8k docs and then throws the error shown at the start of this post.

There was never any follow up on this point - only the suggestion to import via shell command…but am wondering if any progress can be made on this issue of using Compass.

The handout People is a file while the handout Restaurants is a zipped folder - - attempting to use it unzipped does not work at all.