Returns information about collections in this database

@link http://www.php.net/manual/en/mongodb.getcollectioninfo.php
@param array $options An array of options for listing the collections.
@return array
335002
public function getCollectionInfo(array $options = [])
    {
        $includeSystemCollections = false;
        // The includeSystemCollections option is no longer supported in the command
        if (isset($options['includeSystemCollections'])) {
            $includeSystemCollections = $options['includeSystemCollections'];
            unset($options['includeSystemCollections']);
        }

        try {
            $collections = $this->db->listCollections($options);
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }

        $getCollectionInfo = function (CollectionInfo $collectionInfo) {
            // @todo do away with __debugInfo once https://jira.mongodb.org/browse/PHPLIB-226 is fixed
            $info = $collectionInfo->__debugInfo();

            return array_filter(
                [
                    'name' => $collectionInfo->getName(),
                    'type' => isset($info['type']) ? $info['type'] : null,
                    'options' => $collectionInfo->getOptions(),
                    'info' => isset($info['info']) ? (array) $info['info'] : null,
                    'idIndex' => isset($info['idIndex']) ? (array) $info['idIndex'] : null,
                ],
                function ($item) {
                    return $item !== null;
                }
            );
        };

        $eligibleCollections = array_filter(
            iterator_to_array($collections),
            $this->getSystemCollectionFilterClosure($includeSystemCollections)
        );

        return array_map($getCollectionInfo, $eligibleCollections);
    }
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];
    }
1248205
public function search(array $options)
    {
        $options = Options::buildOptions(Options::$defaultOptions, $options, $this);

        $deferred = new Deferred();

        $this->http->get(Endpoints::SEARCH.$options)->then(function ($response) use ($deferred) {
            $collection = new Collection();

            foreach ($response as $key => $values) {
                if ($key == 'artists') {
                    $artists = new Collection();

                    foreach ($values['items'] as $value) {
                        $artists->push(new Artist($this->http, $this, $value));
                    }

                    $collection['artists'] = $artists;
                } elseif ($key == 'albums') {
                    $albums = new Collection();

                    foreach ($values['items'] as $value) {
                        $albums->push(new Album($this->http, $this, $value));
                    }

                    $collection['albums'] = $albums;
                } elseif ($key == 'playlists') {
                    $playlists = new Collection();

                    foreach ($values['items'] as $value) {
                        $playlists->push(new Playlist($this->http, $this, $value));
                    }

                    $collection['playlists'] = $playlists;
                } elseif ($key == 'tracks') {
                    $tracks = new Collection();

                    foreach ($values['items'] as $value) {
                        $tracks->push(new Track($this->http, $this, $value));
                    }

                    $collection['tracks'] = $tracks;
                } elseif ($key == 'videos') {
                    $videos = new Collection();

                    foreach ($values['items'] as $value) {
                        $videos->push(new Video($this->http, $this, $value));
                    }

                    $collection['videos'] = $videos;
                }
            }

            $deferred->resolve($collection);
        }, function ($e) use ($deferred) {
            $deferred->reject($e);
        });

        return $deferred->promise();
    }
495391
public function getIndexs($collection, $options = [])
    {
        if (! $this->hasCollection($collection)) {
            return [];
        }

        $list = [];
        foreach ($this->db->selectCollection($collection)->listIndexes($options) as $index) {
            $list[] = $index->getName();
        }

        return $list;
    }
156988
public static function find($options = [])
    {
        $options = Set::extend(static::query(), $options);
        $schema = static::definition();
        return $schema->query(['query' => $options] + ['finders' => static::finders()]);
    }
1209304
public function collections()
    {
        $uri = $this->uri->withPath($this->uri->getPath() . ':listCollectionIds');
        $value = $this->client->post($uri, null);
        $collections = [];

        foreach ($value['collectionIds'] as $id) {
            $collections[] = $this->collection($id);
        }

        return $collections;
    }
1240690
public function listCollections(array $options = [])
    {
        $collections = [];
        foreach ($this->collections as $name => $collection) {
            $collections[] = [
                'name' => $this->name . '.' . $name,
                'options' => $collection['options']
            ];
        }

        return new CollectionInfoLegacyIterator(new ArrayIterator($collections));
    }
42575
public function getCollection(array $options = array())
    {
        /** @var UserEntity[] $collection */
        $collection = $this->userManager->findUsers();
        $resource   = new Resource($this->generateBrowseUrl(), array('count' => count($collection)));

        foreach ($collection as $element) {
            $resource->setEmbedded('user', $this->createResourceFromUser($element));
        }

        return $resource;
    }
57086
protected function retrievePaginatedListing(array $options)
    {
        $resultPaginator = $this->s3Client->getPaginator('ListObjects', $options);
        $listing = [];

        foreach ($resultPaginator as $result) {
            $listing = array_merge($listing, $result->get('Contents') ?: [], $result->get('CommonPrefixes') ?: []);
        }

        return $listing;
    }
1205493
public function getCollection($id, array $options = [])
    {
        $this->setOptions($options);
        $coll = new Collection($this->client, $this->database);
        $coll->setHeaders($this->getHeaders());
        $rs = $coll->get($id);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
717720
protected function getListCollectionItem()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;
        $conditions['collection_id'] = $this->data_collection['collection_id'];

        return $this->collection_item->getItems($conditions);
    }
373246
public function getCollections()
    {
        $cursor = $this->server->executeCommand($this->database,
            new \MongoDb\Driver\Command(['listCollections' => 1]));
        $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);

        $result = new \IteratorIterator($cursor);

        $this->queriesResultCache[ 'collectionNames' ] = [];

        foreach ($result as $collection) {
            if ($collection[ 'type' ] === 'collection') {
                $this->queriesResultCache[ 'collectionNames' ][] = $collection[ 'name' ];
            }
        }

        return $this->queriesResultCache[ 'collectionNames' ];
    }
57203
public function findAll(): OptionCollection
    {
        $options = [];

        foreach ($this->repositories as $repository) {
            array_push($options, ...$repository->findAll());
        }

        return new OptionCollection\ArrayOptionCollection($options);
    }
480582
public function allCollections($wrap = false)
    {
        $collections = $this->database->listCollections();

        if (! $wrap) {
            return $collections;
        }

        return array_map(
            function ($collection) {
                return new Collection($collection);
            },
            $collections
        );
    }
565554
protected function optionsToRaw(array $options)
    {
        $collections = [];

        foreach ($options as $lang => $labels) {
            $finalWithTranslations = [];
            foreach ($labels as $label) {
                if ($label->isPlain) {
                    $collections[$label->value] = $label->text;
                } else {
                    $collections[$label->lang][$label->value] = $label->text;
                }
            }
        }

        $finals = [];

        foreach ($collections as $value => $collection) {
            $finals[$value] = is_array($collection) ? (object) $collection : $collection;
        }

        return (object) $finals;
    }
777558
private function getCollectionBy($configuration)
    {
        if (!$configuration) {
            return null;
        }

        $db = $this->connection->selectDB($configuration['db']);
        return $db->{$configuration['collection']};
    }
370445
public function selectCollection($name, array $options = [])
    {
        if (!isset($this->collections[$name])) {
            $this->createCollection($name);
        }
        return $this->collections[$name]['collection'];
    }