cond

open fun <R : Any, T> cond(condition: Value<R, Boolean>, ifTrue: Value<R, T>, ifFalse: Value<R, T>): Value<R, T>(source)

Decides between two values depending on the evaluation of a boolean value.

Example

class User(
val name: String,
val score: Int,
val multiplier: Int,
)

users.updateManyWithPipeline {
set {
User::score set cond(
condition = of(User::multiplier) gt of(2),
ifTrue = of(User::score) * of(User::multiplier),
ifFalse = of(User::score)
)
}
}

External resources

See also

Specify multiple conditions.