Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
MongoCursor::explain - Return an explanation of the query, often useful for optimization and debugging
Вернуться к: MongoCursor
MongoCursor::explain
(PECL mongo >=0.9.2)
MongoCursor::explain — Return an explanation of the query, often useful for optimization and debugging
Описание
public array MongoCursor::explain
( void
)
Список параметров
У этой функции нет параметров.
Возвращаемые значения
Returns an explanation of the query.
Примеры
Пример #1 MongoCursor::explain() example
<?php
$cursor = $collection->find(array("x"=>1), array("y"));
$cursor->sort(array("z" => 1))->limit(4)->skip(5);
var_dump($cursor->explain());
?>
Результатом выполнения данного примера будет что-то подобное:
array(8) {
["cursor"]=>
string(15) "BtreeCursor x_1"
["startKey"]=>
array(1) {
["x"]=>
int(1)
}
["endKey"]=>
array(1) {
["x"]=>
int(1)
}
["nscanned"]=>
float(4)
["n"]=>
int(4)
["scanAndOrder"]=>
int(1)
["millis"]=>
int(3)
["allPlans"]=>
array(2) {
[0]=>
array(3) {
["cursor"]=>
string(15) "BtreeCursor x_1"
["startKey"]=>
array(1) {
["x"]=>
int(1)
}
["endKey"]=>
array(1) {
["x"]=>
int(1)
}
}
[1]=>
array(3) {
["cursor"]=>
string(11) "BasicCursor"
["startKey"]=>
array(0) {
}
["endKey"]=>
array(0) {
}
}
}
}
Ошибки
Throws MongoConnectionException if it cannot reach the database.
Смотрите также
MongoDB core docs on » explain.
Вернуться к: MongoCursor