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
AnyRef, Any
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. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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

  5. 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

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. 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

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  14. 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

  15. 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

  16. 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

  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  19. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  21. 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

  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. 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

  24. 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

  25. 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

  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  29. 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

  30. 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

  31. 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

  32. 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

  33. 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

  34. 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

  35. 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

  36. 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

  37. 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

  38. 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

  39. 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)

  40. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  41. def toString(): String
    Definition Classes
    AnyRef → Any
  42. 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

  43. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  44. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  45. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped