@param string $collectionName
@param array  $options

@return Collection
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);
    }
121794
public void createMongoDBCollection(String colectionName, DataTable options) {
        BasicDBObject aux = new BasicDBObject();
        // Recorremos las options para castearlas y añadirlas a la collection
        List<List<String>> rowsOp = options.raw();
        for (int i = 0; i < rowsOp.size(); i++) {
            List<String> rowOp = rowsOp.get(i);
            if (rowOp.get(0).equals("size") || rowOp.get(0).equals("max")) {
                int intproperty = Integer.parseInt(rowOp.get(1));
                aux.append(rowOp.get(0), intproperty);
            } else {
                Boolean boolProperty = Boolean.parseBoolean(rowOp.get(1));
                aux.append(rowOp.get(0), boolProperty);
            }
        }
        dataBase.createCollection(colectionName, aux);
    }
199937
public static MongoCollection<Document> createCollection(MongoDatabase db,
            String collectionName, CreateCollectionOptions options) {
        db.createCollection(collectionName, options);
        return db.getCollection(collectionName);
    }
300016
public function createCollection(array $data, array $options = [])
    {
        $this->setOptions($options);
        $coll = new Collection($this->client, $this->database);
        $coll->setHeaders($this->getHeaders());
        $rs = $coll->create($data);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

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

        return $cursor->toArray();
    }
1026306
public function blockJson($blockName, $options = [])
    {
        if (array_key_exists('returnAll', $options) && $options['returnAll']) {
            // don't load blocks from db (otherwise every db block will always be found)
            return collect([])->toJson();
        }
        return parent::blockJson($blockName, $options);
    }
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));
    }
227083
function (options) {
            var collections = {};

            if (_.size(this.collections)) {
                for (var i = 0; i < this.collections.length; i++) {
                    collections[this.collections[i]] = options.ctl.ctx.collections[this.collections[i]];
                    if (!collections[this.collections[i]]) {
                        throw new Error('Could not resolve collection ' + this.collections[i] + ' for collection view ' + options.name);
                    }
                }
                this.collections = collections;
            } else if (_.isString(this.collection)) {
                this.collection = options.ctl.ctx.collections[this.collection];
                if (!this.collection) {
                    throw new Error('Could not resolve collection ' + this.collection + ' for collection view ' + options.name);
                }
            } else {
                throw new Error('No collection associated with collection view ' + options.name);
            }
            flexo.CollectionView.call(this, options);
        }
27486
public function count($collectionName, $condition = [], $options = [])
    {
        $this->document = $this->db->getQueryBuilder()->count($collectionName, $condition, $options);

        $result = current($this->execute()->toArray());
        return $result['n'];
    }
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;
    }
511973
public function dropCollection($collectionName)
    {
        $this->document = $this->db->getQueryBuilder()->dropCollection($collectionName);

        $result = current($this->execute()->toArray());
        return $result['ok'] > 0;
    }
932552
public function insert($collectionName, array $data, array $options = []) {
		$collection = $this->getCollection($collectionName);
		
		if ($this->_profilerEnabled) {
			$message = 'db.' . $collectionName . '.insert(' . json_encode($data) . ');';
			$event   = $this->getProfiler()->startInsert($message);
		}

		$result  = $collection->insert($data, $options);
		$success = (bool) $result['ok'];
		
		if ($this->_profilerEnabled) {
			$success
				? $event->stopSuccess()
				: $event->stopError();
		}
		
		return $success;
	}
707881
public static function toHeader($collection, $options = [])
    {
        $defaults = [
            'length'    => 0,
            'maxLength' => 0
        ];
        $options += $defaults;

        if (strtolower($collection->name()) === 'set-cookie') {
            $header = static::wrap($collection->name() . ': ' . join("\r\n" . $collection->name() . ': ', $collection->data()), $options['length']);
        } else {
            $header = static::wrap($collection->name() . ': ' . $collection->value(), $options['length']);
        }

        $maxLength = $options['maxLength'];
        if ($maxLength && preg_match('~^(.{' . $maxLength . ',})~m', $header)) {
            throw new RuntimeException("A header line with more that {$maxLength} characters has been detected.");
        }
        return $header;
    }
875911
public function findAll(): OptionCollection
    {
        $collection = new OptionCollection\ArrayOptionCollection();

        foreach ($this->schema as $key => $value) {
            $collection->add($this->find($key));
        }

        return $collection;
    }
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;
    }
11733
public function aggregate($collectionName, $pipelines, $options = [])
    {
        foreach ($pipelines as $key => $pipeline) {
            if (isset($pipeline['$match'])) {
                $pipelines[$key]['$match'] = $this->buildCondition($pipeline['$match']);
            }
        }

        $document = array_merge(
            [
                'aggregate' => $collectionName,
                'pipeline' => $pipelines,
                'allowDiskUse' => false,
            ],
            $options
        );

        return $document;
    }
708371
public function deleteMany($collectionName, array $ids)
     {
        $ids = join(',', $ids);
        $queryParams = ['collection_name' => $collectionName, 'ids' => $ids];
        $response = $this->client->request('DELETE', 'collections/?'.http_build_query($queryParams));
        $body = $response->getBody()->getContents();
        return json_decode($body, true);
     }