After installing mongodb with brew in OS X environment
Import a json file according to the tutorial on official documents
Input:
mongoimport --db test --collection restaurants --drop --file primer-dataset.json
An error was reported during the process.
Failed: error connnecting to db server: no reachable servers
Seek a solution
Solutions already tried:
1.mongoimport --host=127.0.0.1 --port=27017 --db test --collection restaurants --drop --file primer-dataset.json
2.brew update && brew upgrade
Add:
1. Import the file after starting mongodb and report an error:
Failed: error processing document #9870: unexpected EOF
看上去像是数据文件损坏, vi打开看一下要导入的数据文件.
Are you sure your mongodb is activated?