Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.queryFilterQueryisMapNotEmpty

isMapNotEmpty

open fun Field<T, Map<String, *>>.isMapNotEmpty()

Matches documents in which a map is not empty.

Example

Return all users that have one or more grades.

class User(
    val name: String?,
    val grades: Map<String, Int>
)

collection.find {
    User::grades.isMapNotEmpty()
}

See also

open fun KProperty1<T, Map<String, *>>.isMapNotEmpty()

Matches documents in which a map is not empty.

Example

Return all users that have one or more grades.

class User(
    val name: String?,
    val grades: Map<String, Int>
)

collection.find {
    User::grades.isMapNotEmpty()
}

See also