Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /

MongoDB\ChangeStream::getCursorId()

MongoDB\ChangeStream::getCursorId()

Devuelve el ID del cursor del flujo de cambio.

function getCursorId(): MongoDB\Driver\CursorId

A MongoDB\Driver\CursorId objeto.

Este ejemplo reporta el ID del cursor de un flujo de cambios.

<?php
$uri = 'mongodb://rs1.example.com,rs2.example.com/?replicaSet=myReplicaSet';
$collection = (new MongoDB\Client($uri))->test->inventory;
$changeStream = $collection->watch();
var_dump($changeStream->getCursorId());

La vista de salida se ilustraría como sigue:

object(MongoDB\Driver\CursorId)#5 (1) {
["id"]=>
int(8462642181784669708)
}
  • MongoDB\Client::watch()

  • MongoDB\Collection::watch()

  • MongoDB\Database::watch()

  • MongoDB\Driver\CursorId

  • MongoDB\Driver\Cursor::getId()

Volver

current()

En esta página