Get index list in collection.

@param string $collection
@param array $options
@return array
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;
    }
962503
public function selectCollection($collectionName, array $options = [])
    {
        $options += [
            'readConcern' => $this->readConcern,
            'readPreference' => $this->readPreference,
            'writeConcern' => $this->writeConcern,
        ];

        return new Collection($this->manager, $this->databaseName, $collectionName, $options);
    }
748008
public function listCollections($condition = [], $options = [])
    {
        $this->document = $this->db->getQueryBuilder()->listCollections($condition, $options);
        $cursor = $this->execute();

        return $cursor->toArray();
    }
891500
public static function ensureIndex($keys, $options = array()){

        $result = self::connection()->ensureIndex(self::collectionName(), $keys, $options);

        return $result;

    }
528928
public function count($collectionName, $condition = [], $options = [])
    {
        $document = ['count' => $collectionName];

        if (!empty($condition)) {
            $document['query'] = (object) $this->buildCondition($condition);
        }

        return array_merge($document, $options);
    }
98773
private function getCollectionOptionsHash(array $options)
    {
        ksort($options);
        $str = '';
        foreach ($options as $option) {
            if (!$option instanceof  Serializable) {
                // All valid Collection options are BSON serializable
                continue;
            }
            $str .= serialize($option->bsonSerialize());
        }

        return md5($str);
    }
1346639
public static function toKeyIndex($collection, $key, $useDotSyntax = false)
    {
        $keyIndexArray = [];
        foreach ($collection as $item) {
            $itemArray = is_array($item) ? $item : (method_exists($item, 'toArray') ? $item->toArray() : []);
            $keyValue = self::get($itemArray, $key, null, $useDotSyntax);
            $keyIndexArray[$keyValue] = $itemArray;
        }

        return $keyIndexArray;
    }
94838
public function toJson($options = 0)
    {
        $collection = new Collection(array_values($this->items));

        return $collection->toJson($options);
    }
71730
public function get ($options = NULL) {

		// String = view, array = specific fields
		$view = (sizeof($this->fields) === 0) ? $this->view : $this->fields;
		
		return $this->api->read($this->list_name, $this->limit, $this, $view, NULL, $this->options);
	}
594482
public function getCollectionItems(array $conditions, array $options, $model)
    {
        $conditions += array(
            'status' => 1,
            'store_id' => $this->getStoreId()
        );

        $items = $model->getItems($conditions);

        if (!empty($items)) {

            $item = reset($items);

            $options += array(
                'entity' => $item['collection_item']['type'],
                'template_item' => $item['collection_handler']['template']['item']
            );

            $this->prepareEntityItems($items, $options);
        }

        return $items;
    }
1200784
public static function toList($collection) {
		$list = new ArrayList();
		foreach ($collection as $v) {
			$list->add(self::toCollection($v));
		}
		return $list;
	}
926098
public function collection($name, $options = null)
    {
        if (!isset($this->_collections[$name])) {
            $this->_collections[$name] = new Collection($name, $this->_connector, $options);
        }

        return $this->_collections[$name];
    }
194552
public function getCollection(array $options = array())
    {
        /** @var ClientEntity[] $collection */
        $collection = $this->getRepository()->findAll();
        $resource   = new Resource($this->generateBrowseUrl(), array('count' => count($collection)));

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

        return $resource;
    }
367292
public function indexOf($collection=null, $item=null) {
    list($collection, $item) = self::_wrapArgs(func_get_args(), 2);
    
    $collection = self::_collection($collection);
    
    $key = array_search($item, $collection, true);
    return self::_wrap((is_bool($key)) ? -1 : $key);
  }
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;
    }
115995
public static function getRevisionRecords($options = [])
    {
        $options = Util::prepareOptions($options, [
            'indexField' => false,
            'conditions' => [],
            'order' => false,
            'limit' => false,
            'offset' => 0,
        ]);

        $query = 'SELECT * FROM `%s` WHERE (%s)';
        $params = [
            static::getHistoryTable(),
            count($options['conditions']) ? join(') AND (', static::_mapConditions($options['conditions'])) : 1,
        ];

        if ($options['order']) {
            $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order']));
        }

        if ($options['limit']) {
            $query .= sprintf(' LIMIT %u,%u', $options['offset'], $options['limit']);
        }


        if ($options['indexField']) {
            return DB::table(static::_cn($options['indexField']), $query, $params);
        } else {
            return DB::allRecords($query, $params);
        }
    }
110565
public function getList(array $options = array())
    {
        $sql = 'SELECT *';

        if (!empty($options['count'])) {
            $sql = 'SELECT COUNT(credential_id)';
        }

        $sql .= ' FROM module_gapi_credential WHERE credential_id IS NOT NULL';

        $conditions = array();

        if (isset($options['type'])) {
            $sql .= ' AND type=?';
            $conditions[] = $options['type'];
        }

        $allowed_order = array('asc', 'desc');
        $allowed_sort = array('name', 'credential_id', 'created', 'modified', 'type');

        if (isset($options['sort'])
            && in_array($options['sort'], $allowed_sort)
            && isset($options['order'])
            && in_array($options['order'], $allowed_order)) {
            $sql .= " ORDER BY {$options['sort']} {$options['order']}";
        } else {
            $sql .= ' ORDER BY created DESC';
        }

        if (!empty($options['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
        }

        if (empty($options['count'])) {
            $fetch_options = array('index' => 'credential_id', 'unserialize' => 'data');
            $result = $this->db->fetchAll($sql, $conditions, $fetch_options);
        } else {
            $result = (int) $this->db->fetchColumn($sql, $conditions);
        }

        return $result;
    }