|
MongoCursor::addOption(PECL mongo >=1.0.4) MongoCursor::addOption — Adds a top-level key/value pair to a query ОписаниеThis is an advanced function and should not be used unless you know what you're doing. A query can optionally be nested in a "query" field if other options, such as a sort or hint, are given. For instance, adding a sort causes the query to become a subfield of a bigger query object, like:
<?php This method is for adding a top-level field to a query. It makes the query a subobject (if it isn't already) and adds the key/value pair of your chosing to the top level. Внимание
It cannot be used to add extra criteria to a query on the fly. For instance, this will not work:
<?php Список параметров
Возвращаемые значенияReturns this cursor. ОшибкиThrows MongoCursorException if this cursor has started iterating. ПримерыПример #1 MongoCursor::addOption() example Using MongoCursor::skip() to skip over millions of results can become slow. One way around this is to use $min or $max options for the query. These can be handy, but they require an index on exactly the fields being searched for. This is an example of how to use $min as an alternative to MongoCursor::skip().
<?php |
|