Beispiel #1
0
 /**
  * Gives the database a hint about the query
  *
  * @param mixed $index - Index to use for the query. If a string is
  *   passed, it should correspond to an index name. If an array or object
  *   is passed, it should correspond to the specification used to create
  *   the index (i.e. the first argument to
  *   MongoCollection::ensureIndex()).
  *
  * @return MongoCursor - Returns this cursor.
  */
 public function hint($index)
 {
     if (is_object($index)) {
         $index = get_object_vars($index);
     }
     if (is_array($index)) {
         $index = MongoCollection::_toIndexString($index);
     }
     $this->query['$hint'] = $index;
     return $this;
 }