setOnInsert

@JvmName(name = "setOnInsertExt")
infix fun <T> KProperty<T?>.setOnInsert(value: T?): Bson

Creates an update that sets the value of the property to the given value, but only if the update is an upsert that results in an insert of a document.

Return

the update @mongodb.driver.manual reference/operator/update/setOnInsert/ $setOnInsert

Parameters

value

the value

the value type

See also

UpdateOptions

#upsert(boolean)


fun <T> setOnInsert(property: KProperty<T?>, value: T?): Bson

Creates an update that sets the value of the property to the given value, but only if the update is an upsert that results in an insert of a document.

Return

the update @mongodb.driver.manual reference/operator/update/setOnInsert/ $setOnInsert

Parameters

property

the property

value

the value

the value type

See also

UpdateOptions

#upsert(boolean)