You are viewing an offline version of MongoDB documentation. Some page features might be unavailable. To view the latest version of the page or use interactive features, visit the live page.
MongoDB\ChangeStream::getCursorId()
Definition
Return Values
A MongoDB\Driver\CursorId object.
Examples
This example reports the cursor ID for a change stream.
$uri = 'mongodb://rs1.example.com,rs2.example.com/?replicaSet=myReplicaSet'; $collection = (new MongoDB\Client($uri))->test->inventory; $changeStream = $collection->watch(); var_dump($changeStream->getCursorId());
The output would then resemble:
object(MongoDB\Driver\CursorId)#5 (1) { ["id"]=> int(8462642181784669708) }