MongoDB错误导入数据库中的CSV文件

时间:2017-02-23 06:29:19

标签: mongodb

  

在mongoDB中导入此CSV文件时,我们会收到以下错误消息

mongoimport --db betahrprocesses --collection cityStates --type csv --headerline --file /Applications/MAMP/pincode.csv
  

错误讯息::

2017-02-23T11:54:32.911+0530 E QUERY    [main] SyntaxError: missing ; before statement @(shell):1:14

1 个答案:

答案 0 :(得分:0)

尝试在OS shell中运行它,而不是mongo shell:

 myRef.addValueEventListener(new ValueEventListener() {
 @Override
 public void onDataChange(DataSnapshot dataSnapshot) {
 Map <String, String> map = dataSnapshot.getValue(Map.class);

 }

 @Override
 public void onCancelled(DatabaseError databaseError) {
 Log.i("error", "error");
 }
 });

现在退出mongo shell并在os shell中运行:

vao@vao-VirtualBox:~$ mongo --quiet
> mongoimport --db betahrprocesses --collection cityStates --type csv --headerline --file pincode.csv
2017-02-23T09:02:16.954+0000 E QUERY    [thread1] SyntaxError: missing ; before statement @(shell):1:14

检查结果:

> ^C
vao@vao-VirtualBox:~$ mongoimport --db betahrprocesses --collection cityStates --type csv --headerline --file pincode.csv
2017-02-23T09:02:27.079+0000    connected to: localhost
2017-02-23T09:02:27.080+0000    imported 1 document