Packages

object Updates

A factory for document updates. A convenient way to use this class is to statically import all of its methods, which allows usage like:

collection.updateOne(eq("x", 1), set("x", 2))

Since

1.0

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Updates
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def addEachToSet[TItem](fieldName: String, values: TItem*): Bson

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

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

    TItem

    the value type

    fieldName

    the non-null field name

    values

    the values

    returns

    the update

    See also

    $addToSet

  2. def addToSet[TItem](fieldName: String, value: TItem): Bson

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

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

    TItem

    the value type

    fieldName

    the non-null field name

    value

    the value

    returns

    the update

    See also

    $addToSet

  3. def bitwiseAnd(fieldName: String, value: Long): Bson

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

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

    fieldName

    the field name

    value

    the value

    returns

    the update

    See also

    $bit

  4. def bitwiseAnd(fieldName: String, value: Int): Bson

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

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

    fieldName

    the field name

    value

    the value

    returns

    the update

  5. def bitwiseOr(fieldName: String, value: Long): Bson

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

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

    fieldName

    the field name

    value

    the value

    returns

    the update

    See also

    $bit

  6. def bitwiseOr(fieldName: String, value: Int): Bson

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

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

    fieldName

    the field name

    value

    the value

    returns

    the update

    See also

    $bit

  7. def bitwiseXor(fieldName: String, value: Long): Bson

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

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

    fieldName

    the field name

    value

    the value

    returns

    the update

  8. def bitwiseXor(fieldName: String, value: Int): Bson

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

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

    fieldName

    the field name

    value

    the value

    returns

    the update

  9. def combine(updates: Bson*): Bson

    Combine a list of updates into a single update.

    Combine a list of updates into a single update.

    updates

    the list of updates

    returns

    a combined update

  10. def currentDate(fieldName: String): Bson

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

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

    fieldName

    the non-null field name

    returns

    the update

    See also

    $currentDate

    Date

  11. def currentTimestamp(fieldName: String): Bson

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

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

    fieldName

    the non-null field name

    returns

    the update

    See also

    $currentDate

    Timestamp

  12. def inc(fieldName: String, number: Number): Bson

    Creates an update that increments the value of the field with the given name by the given value.

    Creates an update that increments the value of the field with the given name by the given value.

    fieldName

    the non-null field name

    number

    the value

    returns

    the update

    See also

    $inc

  13. def max[TItem](fieldName: String, value: TItem): Bson

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

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

    TItem

    the value type

    fieldName

    the non-null field name

    value

    the value

    returns

    the update

    See also

    $min

  14. def min[TItem](fieldName: String, value: TItem): Bson

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

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

    TItem

    the value type

    fieldName

    the non-null field name

    value

    the value

    returns

    the update

    See also

    $min

  15. def mul(fieldName: String, number: Number): Bson

    Creates an update that multiplies the value of the field with the given name by the given number.

    Creates an update that multiplies the value of the field with the given name by the given number.

    fieldName

    the non-null field name

    number

    the non-null number

    returns

    the update

    See also

    $mul

  16. def popFirst(fieldName: String): Bson

    Creates an update that pops the first element of an array that is the value of the field with the given name.

    Creates an update that pops the first element of an array that is the value of the field with the given name.

    fieldName

    the non-null field name

    returns

    the update

    See also

    $pop

  17. def popLast(fieldName: String): Bson

    Creates an update that pops the last element of an array that is the value of the field with the given name.

    Creates an update that pops the last element of an array that is the value of the field with the given name.

    fieldName

    the non-null field name

    returns

    the update

    See also

    $pop

  18. def pull[TItem](fieldName: String, value: TItem): Bson

    Creates an update that removes all instances of the given value from the array value of the field with the given name.

    Creates an update that removes all instances of the given value from the array value of the field with the given name.

    TItem

    the value type

    fieldName

    the non-null field name

    value

    the value

    returns

    the update

    See also

    $pull

  19. def pullAll[TItem](fieldName: String, values: TItem*): Bson

    Creates an update that removes all instances of the given values from the array value of the field with the given name.

    Creates an update that removes all instances of the given values from the array value of the field with the given name.

    TItem

    the value type

    fieldName

    the non-null field name

    values

    the values

    returns

    the update

    See also

    $pull

  20. def pullByFilter(filter: Bson): Bson

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

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

    filter

    the query filter

    returns

    the update

    See also

    $pull

  21. def push[TItem](fieldName: String, value: TItem): Bson

    Creates an update that adds the given value to the array value of the field with the given name.

    Creates an update that adds the given value to the array value of the field with the given name.

    TItem

    the value type

    fieldName

    the non-null field name

    value

    the value

    returns

    the update

    See also

    $push

  22. def pushEach[TItem](fieldName: String, options: com.mongodb.client.model.PushOptions, values: TItem*): Bson

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

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

    TItem

    the value type

    fieldName

    the non-null field name

    options

    the non-null push options

    values

    the values

    returns

    the update

    See also

    $push

  23. def pushEach[TItem](fieldName: String, values: TItem*): Bson

    Creates an update that adds each of the given values to the array value of the field with the given name.

    Creates an update that adds each of the given values to the array value of the field with the given name.

    TItem

    the value type

    fieldName

    the non-null field name

    values

    the values

    returns

    the update

    See also

    $push

  24. def rename(fieldName: String, newFieldName: String): Bson

    Creates an update that renames a field.

    Creates an update that renames a field.

    fieldName

    the non-null field name

    newFieldName

    the non-null new field name

    returns

    the update

    See also

    $rename

  25. def set[TItem](fieldName: String, value: TItem): Bson

    Creates an update that sets the value of the field with the given name to the given value.

    Creates an update that sets the value of the field with the given name to the given value.

    TItem

    the value type

    fieldName

    the non-null field name

    value

    the value

    returns

    the update

    See also

    $set

  26. def setOnInsert[TItem](fieldName: String, value: TItem): Bson

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

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

    TItem

    the value type

    fieldName

    the non-null field name

    value

    the value

    returns

    the update

    See also

    $setOnInsert

    UpdateOptions#upsert(boolean)

  27. def unset(fieldName: String): Bson

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

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

    fieldName

    the non-null field name

    returns

    the update

    See also

    $unset