Example #1
0
 /**
  * Returns the Mongo collection for the file chunks.
  * @param boolean $refresh whether to reload the collection instance even if it is found in the cache.
  * @return \rock\mongodb\Collection mongo collection instance.
  */
 public function getChunkCollection($refresh = false)
 {
     if ($refresh || !is_object($this->_chunkCollection)) {
         $this->_chunkCollection = Instance::ensure(['class' => \rock\mongodb\Collection::className(), 'mongoCollection' => $this->mongoCollection->chunks]);
     }
     return $this->_chunkCollection;
 }
Example #2
0
 /**
  * Selects collection with given name.
  * @param string $name collection name.
  * @return Collection collection instance.
  */
 protected function selectCollection($name)
 {
     return Instance::ensure(['class' => Collection::className(), 'mongoCollection' => $this->mongoDb->selectCollection($name), 'connection' => $this->connection]);
 }