eqNotNull

open infix fun <V> Field<T, V>.eqNotNull(value: V?)(source)
open infix fun <V> KProperty1<T, V>.eqNotNull(value: V?)(source)

Matches documents where the value of a field equals value.

If value is null, the operator is not added (all documents are matched).

Example

This operator is useful to simplify searches when the criteria are optional. For example, instead of writing:

collection.find {
if (criteria.name != null)
User::name eq criteria.name
}

this operator can be used instead:

collection.find {
User::name eqNotNull criteria.name
}

External resources

See also

Equality filter.