killCursor() public method

Kills a specific cursor on the server
public killCursor ( string $serverHash, integer | mongoint64 $id ) : boolean
$serverHash string - The server hash that has the cursor. This can be obtained through MongoCursor::info.
$id integer | mongoint64 - The ID of the cursor to kill. You can either supply an int containing the 64 bit cursor ID, or an object of the MongoInt64 class. The latter is necessary on 32 bit platforms (and Windows).
return boolean - Returns TRUE if the method attempted to kill a cursor, and FALSE if there was something wrong with the arguments (such as a wrong server_hash). The return status does not reflect where the cursor was actually killed as the server does not provide that information.
Beispiel #1
0
<?php

$mongoClient = new MongoClient("mongodb://whisky:13000/?replicaset=seta");
$connections = $mongoClient->getConnections();
foreach ($connections as $con) {
    if ($con['connection']['connection_type_desc'] == "SECONDARY") {
        echo "Closing '{$con['hash']}':";
        $a->close($con['hash']);
    }
}
$mongoClient->selectDB("foo");
$mongoClient->getHosts();
$m->setReadPreference(MongoClient::RP_SECONDARY, array(array('dc' => 'east', 'use' => 'reporting'), array('dc' => 'west'), array()));
var_dump($m->getReadPreference());
$cursor = $collections->find();
$result = $cursor->next();
$info = $cursor->info();
MongoClient::killCursor($info['server'], $info['id']);
var_dump($mongoClient->listDBs());
$c1 = $m->selectCollection("foo", "bar.baz");
$c2 = $m->selectDB("foo")->selectCollection("bar.baz");
var_dump(MongoClient::_toString);