我收到以下错误:
??? 08, 2013 12:05:46 PM com.mongodb.DBTCPConnector initDirectConnection
WARNING: Exception executing isMaster command on localhost/127.0.0.1:27017
java.io.IOException: couldn't connect to [localhost/127.0.0.1:27017] bc:java.net.ConnectException: Connection refused: connect
at com.mongodb.DBPort._open(DBPort.java:214)
at com.mongodb.DBPort.go(DBPort.java:107)
at com.mongodb.DBPort.go(DBPort.java:88)
at com.mongodb.DBPort.findOne(DBPort.java:143)
at com.mongodb.DBPort.runCommand(DBPort.java:148)
at com.mongodb.DBTCPConnector.initDirectConnection(DBTCPConnector.java:548)
at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:527)
at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:277)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:257)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:310)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
at com.mongodb.DB.getCollectionNames(DB.java:412)
at Main.Main.main(Main.java:26)
Run Code Online (Sandbox Code Playgroud)
我的代码很简单(我第一次使用mongo):
MongoClient Client = new MongoClient( "localhost" , 27017 );
DB db = Client.getDB("qw");
DBCollection coll[] = new DBCollection[4];
Set<String> colls = db.getCollectionNames();
for(String s: colls)
System.out.println(s);
Run Code Online (Sandbox Code Playgroud)
问题是什么?
我尝试从MongoDB读取数据.我有一个问题:
Exception in thread "main" com.mongodb.MongoException: db already exists with different case other
Run Code Online (Sandbox Code Playgroud)
这个例子从这里抛出:
DBCursor cur[] = new DBCursor[cursorSize];
...
cur[i].hasNext() // Exeption
Run Code Online (Sandbox Code Playgroud)
问题是什么?
Mongo的版本是2.10.1
new/delete 关键字是使用免费商店
malloc/free 关键字是使用堆
我看到写在某处new使用malloc.怎么会这样?它们不用于内存段?
第二,我看到写在某个地方free后我们不能使用new或delete之后使用malloc.但如果new使用malloc为什么free不起作用?
我们free在newect 之后使用的地方'.这是错误还是未定义的行为?
谢谢
c ++ 11中的auto命令是静态绑定(输入)还是动态绑定?
即如果我有这个代码
auto x = 5;
Run Code Online (Sandbox Code Playgroud)
编译器会决定"x"是一个int,还是会在运行时进行描述?
另外,以下代码中x的类型是什么?
auto x = 5, y = 4.5
Run Code Online (Sandbox Code Playgroud)