Gets the query, fields, limit, and skip for this cursor

MongoCommandCursor::dead
MongoCommandCursor::key
MongoCommandCursor
PHP Manual

# MongoCommandCursor::info

(PECL mongo >=1.5.0)

MongoCommandCursor::info — Gets the query, fields, limit, and skip for this cursor

### Description

public array MongoCommandCursor::info ( void )

This can be called before or after the query.

### Parameters

This function has no parameters.

### Return Values

Returns the namespace, limit, skip, query, fields, connection and iteration information for this cursor.

### Examples

Example #1 MongoCommandCursor::info() example

`<?php
$m = new MongoClient();
$c = $m->test->test;
$cursor = $c->commandCursor( [
'aggregate' => 'test',
'pipeline' => [
[ '$match' => [ '_id' => [ '$exists' => true ] ] ],
]
] );
echo "Before iteration started:\n";
var_dump($cursor->info());
echo "Aftere iteration started:\n";
$cursor->rewind();
var_dump($cursor->info());
?>`

The above example will output something similar to:

    Before iteration started:
    array(8) {
      'ns' =>
      string(9) "test.test"
      'limit' =>
      int(0)
      'batchSize' =>
      int(0)
      'skip' =>
      int(0)
      'flags' =>
      int(0)
      'query' =>
      array(2) {
        'aggregate' =>
        string(4) "test"
        'pipeline' =>
        array(1) {
          [0] =>
          array(1) {
            '$match' =>
            array(1) {
              '_id' =>
              array(1) {
                '$exists' =>
                bool(true)
              }
            }
          }
        }
      }
      'fields' =>
      NULL
      'started_iterating' =>
      bool(false)
    }
    Aftere iteration started:
    array(17) {
      'ns' =>
      string(9) "test.test"
      'limit' =>
      int(0)
      'batchSize' =>
      int(101)
      'skip' =>
      int(0)
      'flags' =>
      int(0)
      'query' =>
      array(3) {
        'aggregate' =>
        string(4) "test"
        'pipeline' =>
        array(1) {
          [0] =>
          array(1) {
            '$match' =>
            array(1) {
              '_id' =>
              array(1) {
                '$exists' =>
                bool(true)
              }
            }
          }
        }
        'cursor' =>
        array(1) {
          'batchSize' =>
          int(101)
        }
      }
      'fields' =>
      NULL
      'started_iterating' =>
      bool(true)
      'id' =>
      int(0)
      'at' =>
      int(0)
      'numReturned' =>
      int(0)
      'server' =>
      string(24) "localhost:27017;-;.;2316"
      'host' =>
      string(9) "localhost"
      'port' =>
      int(27017)
      'connection_type_desc' =>
      string(10) "STANDALONE"
      'firstBatchAt' =>
      int(0)
      'firstBatchNumReturned' =>
      int(1)
    }

MongoCommandCursor::dead
MongoCommandCursor::key
MongoCommandCursor
PHP Manual