Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.queryFilterQueryexists

exists

open fun Field<T, *>.exists()

Matches documents that contain the specified field, including values where the field value is null.

Example

class User(
    val name: String?,
    val age: Int,
)

collection.find {
    User::age.exists()
}

External resources

See also

open fun KProperty1<T, *>.exists()

Matches documents that contain the specified field, including values where the field value is null.

Example

class User(
    val name: String?,
    val age: Int,
)

collection.find {
    User::age.exists()
}

External resources

See also