Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.queryFilterQueryPredicateisOneOf

isOneOf

abstract fun isOneOf(values: Collection<T>)

Selects documents for which this field is equal to one of the given values.

Example

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

collection.find {
    User::name {
        isOneOf(listOf("Alfred", "Arthur"))
    }
}

External resources

See also

open fun isOneOf(vararg values: T)

Selects documents for which this field is equal to one of the given values.

Example

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

collection.find {
    User::name {
        isOneOf("Alfred", "Arthur")
    }
}

External resources

See also