eqNotNull
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 is optional. For example, instead of writing:
collection.find {
User::name {
if (criteria.name != null)
eq(criteria.name)
}
}
Content copied to clipboard
this operator can be used instead:
collection.find {
User::name {
eqNotNull(criteria.name)
}
}
Content copied to clipboard
External resources
See also
Shorthand.
Equality filter.