當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MongoCursor::addOption方法代碼示例

本文整理匯總了PHP中MongoCursor::addOption方法的典型用法代碼示例。如果您正苦於以下問題:PHP MongoCursor::addOption方法的具體用法?PHP MongoCursor::addOption怎麽用?PHP MongoCursor::addOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MongoCursor的用法示例。


在下文中一共展示了MongoCursor::addOption方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: recreate

 /**
  * Recreates the internal MongoCursor.
  */
 public function recreate()
 {
     $this->mongoCursor = $this->collection->getMongoCollection()->find($this->query, $this->fields);
     if ($this->hint !== null) {
         $this->mongoCursor->hint($this->hint);
     }
     if ($this->immortal !== null) {
         $this->mongoCursor->immortal($this->immortal);
     }
     foreach ($this->options as $key => $value) {
         $this->mongoCursor->addOption($key, $value);
     }
     if ($this->batchSize !== null) {
         $this->mongoCursor->batchSize($this->batchSize);
     }
     if ($this->limit !== null) {
         $this->mongoCursor->limit($this->limit);
     }
     if ($this->maxTimeMS !== null) {
         $this->mongoCursor->maxTimeMS($this->maxTimeMS);
     }
     if ($this->skip !== null) {
         $this->mongoCursor->skip($this->skip);
     }
     if ($this->slaveOkay !== null) {
         $this->setMongoCursorSlaveOkay($this->slaveOkay);
     }
     // Set read preferences after slaveOkay, since they may be more specific
     if ($this->readPreference !== null) {
         if ($this->readPreferenceTags !== null) {
             $this->mongoCursor->setReadPreference($this->readPreference, $this->readPreferenceTags);
         } else {
             $this->mongoCursor->setReadPreference($this->readPreference);
         }
     }
     if ($this->snapshot) {
         $this->mongoCursor->snapshot();
     }
     if ($this->sort !== null) {
         $this->mongoCursor->sort($this->sort);
     }
     if ($this->tailable !== null) {
         $this->mongoCursor->tailable($this->tailable);
     }
     if ($this->timeout !== null) {
         $this->mongoCursor->timeout($this->timeout);
     }
 }
開發者ID:malukenho,項目名稱:mongodb,代碼行數:51,代碼來源:Cursor.php

示例2: maxTimeMS

 /**
  * Wrapper method for MongoCursor::maxTimeMS().
  *
  * @see http://php.net/manual/en/mongocursor.maxtimems.php
  * @param integer $ms
  * @return self
  */
 public function maxTimeMS($ms)
 {
     $this->maxTimeMS = (int) $ms;
     $this->mongoCursor->addOption('$maxTimeMS', (int) $ms);
     return $this;
 }
開發者ID:ne0h12,項目名稱:mongodb,代碼行數:13,代碼來源:Cursor.php

示例3: addOption

 public function addOption($key, $value)
 {
     parent::addOption($key, $value);
     return $this;
 }
開發者ID:lisong,項目名稱:incubator,代碼行數:5,代碼來源:Cursor.php

示例4: addOption

 /**
  * 添加選項
  * @param String $key
  * @param String $value
  * @return muMongoCursor
  */
 public function addOption($key, $value)
 {
     $this->oMongoCursor->addOption($key, $value);
     return $this;
 }
開發者ID:diandengs,項目名稱:RechoPHP,代碼行數:11,代碼來源:class.Mumongo.php


注:本文中的MongoCursor::addOption方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。