Returns the MongoDB collection for the file chunks.
@param bool $refresh whether to reload the collection instance even if it is found in the cache.
@return \yii\mongodb\Collection mongo collection instance.
344242
public function getChunkCollection($refresh = false)
    {
        if ($refresh || !is_object($this->_chunkCollection)) {
            $this->_chunkCollection = Yii::createObject([
                'class' => 'yii\mongodb\Collection',
                'database' => $this->database,
                'name' => $this->getPrefix() . '.chunks'
            ]);
        }

        return $this->_chunkCollection;
    }
894921
protected function getCache($key, $refresh, callable $fn)
    {
        if ($refresh || $this->isRefresh()) {
            $this->configCache->remove($key);
        }

        return $this->configCache->get($key, function () use ($fn) {
            return $fn();
        });
    }
179054
public function toRefArray()
    {
        // Retrieve the actual objects.
        $documents = $this->toArray();

        // Get the collection idenfitier
        $collection = (string) $this->collection->getCollection();

        foreach ($documents as &$document) {
            $document = MongoDBRef::create($collection, $document);
        }

        return $documents;
    }
1338388
private function getSubCollection($ref_name, ARef $ref)
    {
        $idkey = 'id_'.$ref->getId();

        if(!array_key_exists($ref_name, $this->separated))
        {
            $this->separated[$ref_name] = [];
        }

        if(!array_key_exists($idkey, $this->separated[$ref_name]))
        {
            $this->separated[$ref_name][$idkey] = $this->collectionFactory->createGroupCollection($this->getType());
        }

        return $this->separated[$ref_name][$idkey];
    }
51250
public function refresh() : self {
      $newCode = $this->collection->assemble();
      $tokens = Helper::getTokensFromString($newCode);

      $this->collection->setItems($tokens);
      return $this;
    }
680617
public function getDevice($refresh = false)
    {
        if (empty($this->detection['device']) || $refresh) {
            $this->detectDevice($this->userAgent);
        }

        return $this->device;
    }
634964
public function getCollection($db = null)
    {
        if ($db === null) {
            $db = Yii::$app->get('mongodb');
        }

        return $db->getCollection($this->from);
    }
1324244
public function get($collection = "")
		{

			$documents = $this->getCursor($collection);

			$returns = array();

			if ($documents && !empty($documents)) {
				foreach ($documents as $doc) {
					$returns[] = $doc;
				}
			}

			return $returns;
		}
1172588
public function getDBRef()
    {
        return $this->isNew() ? null : MongoDBRef::create($this->_collection->getName(), $this->_id);
    }
454164
public function getToken($forceRefresh = false)
    {
        $cached = $this->getCache()->fetch($this->getCacheKey()) ?: $this->token;

        if ($forceRefresh || empty($cached)) {

            $result = $this->getTokenFromServer();

            $this->checkTokenResponse($result);

            $this->setToken(
                $token = $result[$this->tokenJsonKey],
                $this->expiresJsonKey ? $result[$this->expiresJsonKey] : null
            );

            return $token;
        }

        return $cached;
    }
281302
public function findAllJoinPage(bool $refresh = FALSE) : ObjectCollection
    {
        if (!$this->allPageUrlJoinPage || $refresh)
        {
            $this->allPageUrlJoinPage = PageUrlQuery::create()
                ->joinWithPage()
                ->usePageQuery()
                    ->filterByTreeLevel(['min' => 2])
                ->endUse()
                ->orderByUrl()
                ->find();
        }

        return $this->allPageUrlJoinPage;
    }
558966
public function getToken($refresh = false)
    {
        if ($refresh || empty($this->_token)) {
            $data = ['grant_type' => 'client_credentials'];
            $this->_token = $this->_request(self::URN_ISSUE, $data);

            // check for valid response
            if (empty($this->_token->access_token)) {
                throw new AuthException('Unexpected empty token from the authentication server');
            }
        }
        return $this->_token;
    }
1263800
public function refresh() : self {
      $string = $this->assemble();
      $this->cleanCollection();

      $tokens = Helper::getTokensFromString($string);
      $this->setItems($tokens);

      $this->rewind();
      return $this;
    }
1259879
public function getCollection()
    {
        if (!$this->collection) {
            // gridfs
            if ($this->isFile) {
                $this->collection = $this->getConnection()->getMongoDB()->getGridFS($this->collectionName);
            // normal
            } else {
                $this->collection = $this->getConnection()->getMongoDB()->selectCollection($this->collectionName);
            }
        }

        return $this->collection;
    }
1043897
public function getColumns($base = false, $refresh = false)
    {
        //Get the table name
        $name = $base ? $this->getBase() : $this->getName();

        //Get the columns from the schema and perform mapping
        if (!isset($this->__column_cache[$name]) || $refresh)
        {
            $columns = $this->getSchema($name)->columns;
            $this->__column_cache[$name] = $this->mapColumns($columns, true);
        }

        return $this->__column_cache[$name];
    }
1319695
public function getTicket(bool $refresh = false, string $type = 'wx_card'): array
    {
        return parent::getTicket($refresh, $type);
    }
180079
public function getCollection($name, $refresh = false)
    {
        if ($refresh || !array_key_exists($name, $this->_collections)) {
            $this->_collections[$name] = $this->selectCollection($name);
        }

        return $this->_collections[$name];
    }