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
- Alphabetic
- By Inheritance
- Updates
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- 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
- 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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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
- 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
- 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
- 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
- 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
- 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
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- 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
- 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
- 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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
- 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
- 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
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
UpdateOptions#upsert(boolean)
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: