merge

open override fun merge(other: Option): Option(source)

Merges this option with another of the same type.

This method is not meant to be called by end-users. It allows option implementations to customize the behavior when the same option is specified multiple times. This method is called automatically by the KtMongo library.

The caller is responsible for only calling this method with a parameter of the same concrete type as the current instance.

This method returns a new option, which combines the values of both options. The two options passed as parameters must not be modified. This method may return one of the two options passed as parameters.

This method must be called in the same order as the options are defined. For example, if a is defined before b, then a.merge(b) is valid, but b.merge(a) is not.

By default, this method returns the last declared option (other).

This method is called by the option holder's BsonNode.simplify method.