我正在尝试使用mongoimport命令导入json文档,并尝试了所有可能的方法,但它给出了低于错误.Plz告诉我,我在这里做错了什么.我已经给出了json doc的完整路径.我想导入具有800多条记录的大文档,但因为它失败了所以目前我的students.json包含简单的一行{name:"Archana"}但是即使这样也失败了.
C:\data\db>mongo
2016-02-02T17:48:44.788+0530 I CONTROL [main] Hotfix KB2731284 or later update is installed, no need to zero-out data
MongoDB shell version: 3.2.1
connecting to: test
> show collections
names
students
> mondoimport -d test -c students students.json
2016-02-02T17:50:21.001+0530 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:15
> mondoimport -d test -c students < students.json
2016-02-02T17:50:25.840+0530 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:15
> mondoimport -d test -c students < file students.json
2016-02-02T17:50:31.233+0530 E QUERY [thread1] SyntaxError: …
Run Code Online (Sandbox Code Playgroud) package singleton;
public class SingletonClass {
private static SingletonClass singleton = null;
private SingletonClass() {
}
static boolean stopThread = true;
//approach 1 which fails in multithereaded env
/*public static SingletonClass getInstance(){
if(null == singleton){
try {
if(stopThread){
stopThread = false;
Thread.sleep(1000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
singleton = new SingletonClass();
}
return singleton;
}*/
//approach 2 which works
//method is synchronized
/* public static synchronized SingletonClass getInstance(){
if(null == singleton){
try {
if(stopThread){
stopThread = false; …
Run Code Online (Sandbox Code Playgroud)