MongoDB, Java: accessing cursor opens connection that cannot be closed -


i have problem close connection created after accessing mongodb cursor.

i gathering information connections console of running mongod instance. not using mongodb replication nor sharding yet.

for example sample code causing opened connection (assume 'myquery' query, coll mapped using setinternalclass class myobject):

  dbcursor find = coll.find(myquery);   list<myobject> myobjects = new arraylist<myobject>();   while(find.hasnext()) { // line opens connection         myobject next = (myobject) find.next();         myobjects.add(next);   }   find.close(); // line not close connection 

you calling close on find object, dbcursor. mentioned in api documentation close cursor, not underlying connection. close connections should call close on mongo/mongoclient object, either inherits or has close function as per api close connections mongodb server instance.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -