MongoCursor
在线手册:中文  英文

MongoCursor::info

(PECL mongo >=1.0.5)

MongoCursor::infoGets the query, fields, limit, and skip for this cursor

说明

public array MongoCursor::info ( void )

This can be called before or after the query.

参数

此函数没有参数。

返回值

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

更新日志

版本 说明
1.1.0 Added a number of other fields, including id (the cursor id), at (the driver's counter of which document is current), numReturned (the number returned by the server in the current batch), and server (which server the query was sent to—useful in conjunction with Read Preferences.
1.0.10 Added started_iterating field, a boolean indicating if cursor is pre- or post-query.

范例

Example #1 MongoCursor::info() example

<?php

$m 
= new MongoClient();
$cursor $m->foo->bar->find(array("x" => 4), array("y" => false));
var_dump($cursor->info());

?>

以上例程的输出类似于:

array(5) {
  ["ns"]=>
  string(7) "foo.bar"
  ["limit"]=>
  int(0)
  ["skip"]=>
  int(0)
  ["query"]=>
  array(1) {
    ["x"]=>
    int(4)
  }
  ["fields"]=>
  array(1) {
    ["y"]=>
    int(0)
  }
}

MongoCursor
在线手册:中文  英文
易百教程