Updates

object Updates

Updates extension methods to improve Kotlin interop

Since

5.3

Functions

Link copied to clipboard
fun <T> addEachToSet(property: KProperty<Iterable<T>?>, values: List<T>): Bson

Creates an update that adds each of the given values to the array value of the property, unless the value is already present, in which case it does nothing

Link copied to clipboard
fun <T> addToSet(property: KProperty<Iterable<T>?>, value: T): Bson

Creates an update that adds the given value to the array value of the property, unless the value is already present, in which case it does nothing

Link copied to clipboard
@JvmName(name = "addToSetExt")
infix fun <T> KProperty<Iterable<T>?>.addToSet(value: T): Bson

Creates an update that adds the given value to the array value of the property, unless the value is already present, in which case it does nothing

Link copied to clipboard
fun <T : Number?> bitwiseAnd(property: KProperty<T>, value: Int): Bson

Creates an update that performs a bitwise and between the given integer value and the integral value of the property.

fun <T : Number?> bitwiseAnd(property: KProperty<T>, value: Long): Bson

Creates an update that performs a bitwise and between the given long value and the integral value of the property.

Link copied to clipboard
@JvmName(name = "bitwiseAndExt")
infix fun <T : Number?> KProperty<T>.bitwiseAnd(value: Int): Bson

Creates an update that performs a bitwise and between the given integer value and the integral value of the property.

@JvmName(name = "bitwiseAndExt")
infix fun <T : Number?> KProperty<T>.bitwiseAnd(value: Long): Bson

Creates an update that performs a bitwise and between the given long value and the integral value of the property.

Link copied to clipboard
fun <T : Number?> bitwiseOr(property: KProperty<T>, value: Int): Bson

Creates an update that performs a bitwise or between the given integer value and the integral value of the property.

fun <T : Number?> bitwiseOr(property: KProperty<T>, value: Long): Bson

Creates an update that performs a bitwise or between the given long value and the integral value of the property.

Link copied to clipboard
@JvmName(name = "bitwiseOrExt")
infix fun <T : Number?> KProperty<T>.bitwiseOr(value: Int): Bson

Creates an update that performs a bitwise or between the given integer value and the integral value of the property.

@JvmName(name = "bitwiseOrExt")
infix fun <T : Number?> KProperty<T>.bitwiseOr(value: Long): Bson

Creates an update that performs a bitwise or between the given long value and the integral value of the property.

Link copied to clipboard
fun <T : Number?> bitwiseXor(property: KProperty<T>, value: Int): Bson

Creates an update that performs a bitwise xor between the given integer value and the integral value of the property.

fun <T : Number?> bitwiseXor(property: KProperty<T>, value: Long): Bson

Creates an update that performs a bitwise xor between the given long value and the integral value of the property.

Link copied to clipboard
@JvmName(name = "bitwiseXorExt")
infix fun <T : Number?> KProperty<T>.bitwiseXor(value: Int): Bson

Creates an update that performs a bitwise xor between the given integer value and the integral value of the property.

@JvmName(name = "addToSetExt")
infix fun <T : Number?> KProperty<T>.bitwiseXor(value: Long): Bson

Creates an update that performs a bitwise xor between the given long value and the integral value of the property.

Link copied to clipboard
fun combine(vararg updates: Bson): Bson
fun combine(updates: List<Bson>): Bson

Combine a list of updates into a single update.

Link copied to clipboard
fun <T> currentDate(property: KProperty<T>): Bson

Creates an update that sets the value of the property to the current date as a BSON date.

Link copied to clipboard
fun <T> currentTimestamp(property: KProperty<T>): Bson

Creates an update that sets the value of the property to the current date as a BSON timestamp.

Link copied to clipboard
fun <T : Number?> inc(property: KProperty<T>, number: Number): Bson

Creates an update that increments the value of the property by the given value.

Link copied to clipboard
@JvmName(name = "incExt")
infix fun <T : Number?> KProperty<T>.inc(number: Number): Bson

Creates an update that increments the value of the property by the given value.

Link copied to clipboard
fun <T> max(property: KProperty<T>, value: T): Bson

Creates an update that sets the value of the property if the given value is greater than the current value of the property.

Link copied to clipboard
@JvmName(name = "maxExt")
infix fun <T> KProperty<T>.max(value: T): Bson

Creates an update that sets the value of the property if the given value is greater than the current value of the property.

Link copied to clipboard
fun <T> min(property: KProperty<T>, value: T): Bson

Creates an update that sets the value of the property if the given value is less than the current value of the property.

Link copied to clipboard
@JvmName(name = "minExt")
infix fun <T> KProperty<T>.min(value: T): Bson

Creates an update that sets the value of the property if the given value is less than the current value of the property.

Link copied to clipboard
fun <T : Number?> mul(property: KProperty<T>, number: Number): Bson

Creates an update that multiplies the value of the property by the given number.

Link copied to clipboard
@JvmName(name = "mulExt")
infix fun <T : Number?> KProperty<T>.mul(number: Number): Bson

Creates an update that multiplies the value of the property by the given number.

Link copied to clipboard
fun <T> popFirst(property: KProperty<T>): Bson

Creates an update that pops the first element of an array that is the value of the property.

Link copied to clipboard
fun <T> popLast(property: KProperty<T>): Bson

Creates an update that pops the last element of an array that is the value of the property.

Link copied to clipboard
fun <T> pull(property: KProperty<Iterable<T?>?>, value: T?): Bson

Creates an update that removes all instances of the given value from the array value of the property.

Link copied to clipboard
@JvmName(name = "pullExt")
infix fun <T> KProperty<Iterable<T?>?>.pull(value: T?): Bson

Creates an update that removes all instances of the given value from the array value of the property.

Link copied to clipboard
fun <T> pullAll(property: KProperty<Iterable<T>?>, values: List<T?>?): Bson

Creates an update that removes all instances of the given values from the array value of the property.

Link copied to clipboard
@JvmName(name = "pullAllExt")
infix fun <T> KProperty<Iterable<T>?>.pullAll(values: List<T?>?): Bson

Creates an update that removes all instances of the given values from the array value of the property.

Link copied to clipboard
fun pullByFilter(filter: Bson): Bson

Creates an update that removes from an array all elements that match the given filter.

fun pullByFilter(property: KProperty<*>, filter: Bson): Bson

Creates an update that removes all instances of the given value from the array value of the property.

Link copied to clipboard
@JvmName(name = "pullByFilterExt")
infix fun KProperty<*>.pullByFilter(filter: Bson): Bson

Creates an update that removes all instances of the given value from the array value of the property.

Link copied to clipboard
fun <T> push(property: KProperty<Iterable<T>?>, value: T): Bson

Creates an update that adds the given value to the array value of the property.

Link copied to clipboard
fun <T> pushEach(property: KProperty<Iterable<T>?>, values: List<T?>, options: PushOptions = PushOptions()): Bson

Creates an update that adds each of the given values to the array value of the property, applying the given options for positioning the pushed values, and then slicing and/or sorting the array.

Link copied to clipboard
fun <T> rename(property: KProperty<T?>, newProperty: KProperty<T?>): Bson

Creates an update that renames a field.

Link copied to clipboard
@JvmName(name = "renameExt")
infix fun <T> KProperty<T?>.rename(newProperty: KProperty<T?>): Bson

Creates an update that renames a field.

Link copied to clipboard
fun <T> set(property: KProperty<T?>, value: T?): Bson

Creates an update that sets the value of the property to the given value.

Link copied to clipboard
@JvmName(name = "setExt")
infix fun <T> KProperty<T>.set(value: T?): Bson

Creates an update that sets the value of the property to the given value.

Link copied to clipboard
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.

Link copied to clipboard
@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.

Link copied to clipboard
fun <T> unset(property: KProperty<T>): Bson

Creates an update that deletes the property with the given name.