@param array $collectionOptions

@return $this
429993
public function setCollectionOptions(array $collectionOptions)
    {
        if ($this->nested) {
            throw new LogicException(
                sprintf(
                    'Collection options cannot be set for nested document class "%s".',
                    $this->documentClass
                )
            );
        }

        $this->collectionOptions = $collectionOptions;

        return $this;
    }
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));
    }
1025917
public function merge(CollectionInterface $collection)
    {
        $this->items = array_merge(
            $this->getItems(),
            $collection->getItems()
        );

        return $this;
    }
45724
public function setCollection(array $collection)
    {
        if (is_array($this->buildItems) 
                && array_key_exists('collection', $this->buildItems) 
                && !empty($this->buildItems['collection'])) {
            unset($this->collection);
        }
        $this->setBuildItems();
        foreach ($collection as $builder) {
            $this->addBuilder($builder);
        }
        
        return $this;
    }
1283861
public function registerCollection(array $collection)
    {
        foreach ($collection as $name => $handler) {
            $this->register($name, $handler);
        }

        return $this;
    }
539010
public function update(object $parent, array $collections, array $options) : void
    {
        $setStrategyColls     = [];
        $addPushStrategyColls = [];

        foreach ($collections as $coll) {
            $mapping = $coll->getMapping();

            if ($mapping['isInverseSide']) {
                continue; // ignore inverse side
            }
            switch ($mapping['strategy']) {
                case ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET:
                case ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET_ARRAY:
                    throw new UnexpectedValueException($mapping['strategy'] . ' update collection strategy should have been handled by DocumentPersister. Please report a bug in issue tracker');

                case ClassMetadata::STORAGE_STRATEGY_SET:
                case ClassMetadata::STORAGE_STRATEGY_SET_ARRAY:
                    $setStrategyColls[] = $coll;
                    break;

                case ClassMetadata::STORAGE_STRATEGY_ADD_TO_SET:
                case ClassMetadata::STORAGE_STRATEGY_PUSH_ALL:
                    $addPushStrategyColls[] = $coll;
                    break;

                default:
                    throw new UnexpectedValueException('Unsupported collection strategy: ' . $mapping['strategy']);
            }
        }

        if (! empty($setStrategyColls)) {
            $this->setCollections($parent, $setStrategyColls, $options);
        }
        if (empty($addPushStrategyColls)) {
            return;
        }

        $this->deleteElements($parent, $addPushStrategyColls, $options);
        $this->insertElements($parent, $addPushStrategyColls, $options);
    }
585793
public function setOptions(array $options)
    {
        if ($this->options && is_array($options)) {
            $options = ArrayUtils::merge($this->options, $options);
        }

        $this->options = $options;

        return $this;
    }
925188
public function setOptions(array $options)
    {
        foreach ($options as $opt => $val) {
            $this->setOption($opt, $val);
        }

        return $this;
    }
1175803
public function withOptions(int ...$options): OptionsInterface
    {
        foreach ($options as $option) {
            $this->options |= $option;
        }

        return $this;
    }
749334
public function setOptions($options)
	{
		$options = is_array($options) ? $options : array($options);

		foreach ($options as $option)
		{
			$this->addOption($option);
		}

		return $this;
	}
1200882
public function setOptions(array $options) : self
    {
        $this->_options = array_replace_recursive($this->getDefaultOptions(), $options);

        return $this;
    }
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);
    }
349666
public function setOptions(array $options)
    {
        if ($options) {
            foreach ($options as $k => $v) {
                if (in_array($k, ['session'])) {
                    $this->getTokenInstance()->setOptions($k, $v);
                }
            }
            
            $this->getImageHandler()->setOptions($options);
        }
        
        return $this;
    }
123350
public function setOptions(array $options): Options
    {
        foreach ($options as $key => $option) {
            $this->options[$key] = $option;
        }

        return $this;
    }
539623
public function options(array $options): self
    {
        foreach ($options as $name => $value) {
            $this->option($name, $value);
        }

        return $this;
    }
1221417
public function merge(CollectionInterface ...$collections): CollectionInterface
    {
        $temp = [$this->data];

        foreach ($collections as $index => $collection) {
            if (!$collection instanceof static) {
                throw new CollectionMismatchException(
                    \sprintf('Collection with index %d must be of type %s', $index, static::class)
                );
            }

            $temp[] = $collection->toArray();
        }

        return new static(\array_merge(...$temp));
    }
759337
public function collection($collectionId)
    {
        return new CollectionReference(
            $this->connection,
            $this->valueMapper,
            $this->childPath($this->name, $collectionId)
        );
    }