mul

abstract infix fun <V : Number> Field<T, V>.mul(amount: V)(source)
open infix fun <V : Number> KProperty1<T, V>.mul(amount: V)(source)

Multiplies a field by the specified amount.

If the field doesn't exist (either the document doesn't have it, or the operation is an upsert and a new document is created), the field is created with an initial value of 0.

Use of this operator with a field with a null value will generate an error.

Example

class User(
val name: String,
val price: Double,
)

collection.updateMany {
User::price mul 2.0
}

External resources