Get the mongo collection instance

@param string $type "image" or "shortUrl"
@return MongoCollection
977999
private function getCollection($type) {
        if ($this->collections[$type] === null) {
            try {
                $this->collections[$type] = $this->getMongoClient()->selectCollection(
                    $this->params['databaseName'],
                    $type
                );
            } catch (MongoException $e) {
                throw new DatabaseException('Could not select collection', 500, $e);
            }
        }

        return $this->collections[$type];
    }
872724
protected function getResultsByType($type)
    {
        $instance = $this->createModelByType($type);

        $key = $instance->getKeyName();

        $query = $instance->newQuery();

        $query = $this->useWithTrashed($query);

        return $query->whereIn($key, $this->gatherKeysByType($type)->all())->get();
    }
727175
public function getObjectsByCollection(CollectionInterface $collection, callable $callback = null)
    {
        $iterator = $this->resourceRepository->findByCollectionNameIterator($collection->getName());
        $iteration = 0;
        foreach ($this->resourceRepository->iterate($iterator, $callback) as $resource) {
            /** @var PersistentResource $resource */
            $object = new StorageObject();
            $object->setFilename($resource->getFilename());
            $object->setSha1($resource->getSha1());
            $object->setMd5($resource->getMd5());
            $object->setFileSize($resource->getFileSize());
            $object->setStream(function () use ($resource) {
                return $this->getStreamByResource($resource);
            });
            yield $object;
            if (is_callable($callback)) {
                call_user_func($callback, $iteration, $object);
            }
            $iteration++;
        }
    }
7555
public static function items($type)
	{
		if(!isset(self::$_items[$type]))
			self::loadItems($type);
		return self::$_items[$type];
	}
180960
public final static function get($type = 'default') {
        if (!isset(self::$INSTANCES[ $type ])) {
            $defaultPassport = apply_filter('passport\new' . ucfirst($type) . 'Passport', new Passport());
            $passport        = sess_get(self::SESSION_NAME . '_' . $type);
            if ($passport) {
                if (function_exists('igbinary_unserialize')) {
                    self::$INSTANCES[ $type ] = @igbinary_unserialize($passport);
                } else {
                    self::$INSTANCES[ $type ] = @unserialize($passport);
                }
            } else {
                $defaultPassport->type    = $type;
                self::$INSTANCES[ $type ] = $defaultPassport;
            }
        }

        return self::$INSTANCES[ $type ];
    }
402998
protected function setDataCollectionFront($type)
    {
        $collection_id = $this->getStore("data.collection_$type");

        if (!empty($collection_id)) {
            $conditions = array('collection_id' => $collection_id);
            $options = array('imagestyle' => $this->configTheme("image_style_collection_$type"));
            $items = $this->getCollectionItems($conditions, array_filter($options), $this->collection_item);
            $this->setData("collection_$type", $this->getWidgetCollection($items));
        }
    }
487621
public function get()
    {
        return $this->isCollection($this->data)
            ? new Collection($this->data)
            : $this->data;
    }
504783
public function ofType($type)
    {
        $items = [];

        foreach ($this->items as $path => $slug) {
            $page = $this->pages->get($path);
            if ($page !== null && $page->template() === $type) {
                $items[$path] = $slug;
            }
        }

        $this->items = $items;

        return $this;
    }
941740
protected static function getConnection($type) {
    $mapper = self::getMapper($type);
    $conn = $mapper->getConnection();
    return $conn;
  }
38503
private function getCollection() {
        if ($this->collection === null) {
            try {
                $this->collection = $this->getMongoClient()->selectCollection(
                    $this->params['databaseName'],
                    'imagevariation'
                );
            } catch (MongoException $e) {
                throw new DatabaseException('Could not select collection', 500, $e);
            }
        }

        return $this->collection;
    }
823734
public function getFiles($type)
	{
		$f = $type . 'Files';

		if (property_exists($this, $f))
		{
			return self::${$f};
		}

		$this->say('Missing Files: ' . $type);

		return "";
	}
233132
public function load($path, $type = null)
    {
        $dir = $this->locator->locate($path);

        $collection = new RouteCollection();
        $collection->addResource(new DirectoryResource($dir, '/\.php$/'));
        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
            if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) {
                continue;
            }

            if ($class = $this->findClass($file)) {
                $refl = new \ReflectionClass($class);
                if ($refl->isAbstract() || !$refl->implementsInterface('Pablodip\ModuleBundle\Module\ModuleInterface')) {
                    continue;
                }

                $collection->addCollection(parent::load($file->getRealPath(), $type));
            }
        }

        return $collection;
    }
646372
public function withType(Type $type): self
    {
        $metadata = clone $this;
        $metadata->type = $type;

        return $metadata;
    }
38449
public function getObjectsByCollection(CollectionInterface $collection)
    {
        $objects = array();
        $that = $this;
        $bucketName = $this->bucketName;

        foreach ($this->resourceRepository->findByCollectionName($collection->getName()) as $resource) {
            /** @var \Neos\Flow\ResourceManagement\PersistentResource $resource */
            $object = new StorageObject();
            $object->setFilename($resource->getFilename());
            $object->setSha1($resource->getSha1());
            $object->setStream(function () use ($that, $bucketName, $resource) {
                return fopen('s3://' . $bucketName . '/' . $this->keyPrefix . $resource->getSha1(), 'r');
            });
            $objects[] = $object;
        }

        return $objects;
    }
858711
public static function getCardType($type)
    {
        if (isset(self::$cardTypes[$type])) {
            return self::$cardTypes[$type];
        }
        return $type;
    }
566964
public function newObject($collection)
    {
        /** @var MongoObject $obj */
        $obj =$this->container->get($this->classMap->getClassForResult($collection, []));
        $obj->setCollection($collection);

        return $obj;
    }
565590
public function get($collection)
    {
        $collection = $this->makeCollection($collection);

        $url      = UrlHelper::buildUrl(Urls::URL_COLLECTION, [$collection]);
        $response = $this->getConnection()->get($url);

        $data = $response->getJson();

        return Collection::createFromArray($data);
    }