(PECL mongo >=1.5.0)
MongoCommandCursor::info — Obtiene información sobre la creación e iteración del cursor
Se puede llamar antes o después de haber empezado a iterar el cursor.
Esta función no tiene parámetros.
Devuelve el espacio de nombres, tamaño del lote, límite salto, banderas, consulta, y campos protegidos de este cursor. Si el cursor ya ha empezado a iterar, se incluirá información adicional sobre la iteración y la conexión.
Ejemplo #1 Ejemplo de MongoCommandCursor::info()
<?php
$m = new MongoClient();
$cursor = new MongoCommandCursor(
$m, // MongoClient object
'demo.cities', // namespace
[
'aggregate' => 'cities',
'pipeline' => [ [ '$match' => [ '_id' => [ '$exists' => true ] ] ] ],
'cursor' => [ 'batchSize' => 1 ],
]
);
echo "Antes de iniciar la iteración:\n";
var_dump($cursor->info());
echo "\nDespués de iniciar la iteración:\n";
$cursor->rewind();
var_dump($cursor->info());
?>
El resultado del ejemplo sería algo similar a:
Antes de iniciar la iteración:
array(8) {
["ns"]=>
string(11) "demo.cities"
["limit"]=>
int(0)
["batchSize"]=>
int(0)
["skip"]=>
int(0)
["flags"]=>
int(0)
["query"]=>
array(3) {
["aggregate"]=>
string(6) "cities"
["pipeline"]=>
array(1) {
[0]=>
array(1) {
["$match"]=>
array(1) {
["_id"]=>
array(1) {
["$exists"]=>
bool(true)
}
}
}
}
["cursor"]=>
array(1) {
["batchSize"]=>
int(1)
}
}
["fields"]=>
NULL
["started_iterating"]=>
bool(false)
}
Después de iniciar la iteración:
array(17) {
["ns"]=>
string(11) "demo.cities"
["limit"]=>
int(0)
["batchSize"]=>
int(0)
["skip"]=>
int(0)
["flags"]=>
int(0)
["query"]=>
array(3) {
["aggregate"]=>
string(6) "cities"
["pipeline"]=>
array(1) {
[0]=>
array(1) {
["$match"]=>
array(1) {
["_id"]=>
array(1) {
["$exists"]=>
bool(true)
}
}
}
}
["cursor"]=>
array(1) {
["batchSize"]=>
int(1)
}
}
["fields"]=>
NULL
["started_iterating"]=>
bool(true)
["id"]=>
int(185840310129)
["at"]=>
int(0)
["numReturned"]=>
int(0)
["server"]=>
string(25) "localhost:27017;-;.;23991"
["host"]=>
string(9) "localhost"
["port"]=>
int(27017)
["connection_type_desc"]=>
string(10) "STANDALONE"
["firstBatchAt"]=>
int(0)
["firstBatchNumReturned"]=>
int(1)
}