Details
-
Bug
-
Resolution: Won't Fix
-
Major - P3
-
None
-
2.9.0
-
None
Description
DBCursor#iterator is implemented to return a copy of "this":
public Iterator<DBObject> iterator(){
|
return this.copy();
|
}
|
So if you have code like:
DBCursor cursor = c.find();
|
try {
|
for (DBObject obj: cursor) {
|
if (someCondition(obj)) {
|
return obj;
|
}
|
}
|
} finally {
|
cursor.close();
|
}
|
The server-side cursor will not be killed, because the DBCursor that is being closed in the finally block is not the DBCursor that has the the cursor id.