invoke
inline operator fun <V> Field<T, V>.invoke(noinline block: FilterQueryPredicate<V>.() -> Unit)(source)
inline operator fun <V> KProperty1<T, V>.invoke(noinline block: FilterQueryPredicate<V>.() -> Unit)(source)
Targets a single field to execute a targeted predicate.
Example
class User(
val name: String?,
val age: Int,
)
collection.find {
User::name {
eq("foo")
}
}Content copied to clipboard
Note that many operators available this way have a convenience function directly in this class to shorten this. For this example, see eq:
collection.find {
User::name eq "foo"
}Content copied to clipboard