2015-04-03 72 views
0
mongoimport --db test --collection collection1 --file c:/test.json 

我得到了SyntaxError:執行上述命令時出現意外的標識符。SyntaxError:在MongoDB中導入JSON文件時出現意外的標識

這個腳本的問題是什麼?

非常感謝您

+1

可能重複? ](http://stackoverflow.com/questions/16500127/importing-json-file-using-mongimport-keep-getting-unexpected-identifier) – 2015-04-03 17:47:33

回答

4

我有同樣的問題,當我試圖從MongoDB的殼牌導入JSON文件。
您可以從命令提示符查詢它。
我的目錄stucture:

C:\Program files\MongoDB\Server\3.0\bin\mongoimport.exe 
C:\filename.json 

例如

C:\Program Files\MongoDB\Server\3.0\bin> ./mongoimport --db dbname --collection collection_name C:\filename.json 

輸出應該是:

2015-08-18T09:34:25.617-0700 connected to: localhost 
2015-08-18T09:34:25.632-0700 imported 10 documents 

現在切換回MongoDB的外殼:[導入使用mongimport JSON文件,不斷收到\`意想不到的標識符\`的

C:\Program Files\MongoDB\Server\3.0\bin> ./mongo 
use dbname 
db.collection_name.find().pretty() 
相關問題