Skip to content

Commit a2e3b47

Browse files
committed
PHPC-450: Update open cursor check for MongoDB 3.2
1 parent 8e882a2 commit a2e3b47

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/cursor/cursor-destruct-001.phpt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ function getNumOpenCursors(MongoDB\Driver\Manager $manager)
1010
{
1111
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(array('serverStatus' => 1)));
1212
$result = current($cursor->toArray());
13-
return $result->cursors->totalOpen;
13+
14+
if (isset($result->metrics->cursor->open->total)) {
15+
return $result->metrics->cursor->open->total;
16+
}
17+
18+
if (isset($result->cursors->totalOpen)) {
19+
return $result->cursors->totalOpen;
20+
}
21+
22+
throw new RuntimeException('Could not find number of open cursors in serverStatus');
1423
}
1524

1625
$manager = new MongoDB\Driver\Manager(STANDALONE);

0 commit comments

Comments
 (0)