mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 13:47:10 +01:00
Implement the correct way of traversing a cursor
This commit is contained in:
@@ -319,9 +319,11 @@ void MongoDBTest::testCursorRequest()
|
|||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
Poco::MongoDB::ResponseMessage& response = cursor.next(_mongo);
|
Poco::MongoDB::ResponseMessage& response = cursor.next(_mongo);
|
||||||
while(response.cursorID() != 0)
|
while(1)
|
||||||
{
|
{
|
||||||
n += response.documents().size();
|
n += response.documents().size();
|
||||||
|
if ( response.cursorID() == 0 )
|
||||||
|
break;
|
||||||
response = cursor.next(_mongo);
|
response = cursor.next(_mongo);
|
||||||
}
|
}
|
||||||
std::cout << "n= " << n << std::endl;
|
std::cout << "n= " << n << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user