Packages

case class WriteConcern(minNumberOfWrites: Option[Int] = Some(1), writeMode: Option[String] = None, timeout: FiniteDuration = Duration.Zero, j: Option[Boolean] = Some(true), fsync: Option[Boolean] = None) extends Product with Serializable

This class does not correspond directly to MongoDB Write Concern but rather to mgo Safe. See Vault MongoDB.

minNumberOfWrites

how many servers should confirm a write before the operation is considered successful. When set to 0 - requests no acknowledgment of the write operation. If you also set waitForAcknowledge to true, that prevails to request acknowledgment from the standalone mongod or the primary of a replica set. When set to 1 - requests acknowledgment that the write operation has propagated to the standalone mongod or the primary in a replica set. This is the default. When set to greater than 1 - requires acknowledgment from the primary and as many additional data-bearing secondaries to meet the specified value. For example, consider a 3-member replica set with no arbiters. Specifying 2 would require acknowledgment from the primary and one of the secondaries. Specifying 3 would require acknowledgment from the primary and both secondaries.

writeMode

When set to "majority" - requests acknowledgment that write operations have propagated to the calculated majority of the data-bearing voting members (i.e. primary and secondaries with members[n].votes greater than 0). When set to a custom write concern name - Requests acknowledgment that the write operations have propagated to tagged members that satisfy the custom write concern defined in settings.getLastErrorModes. This takes priority over minNumberOfWrites.

timeout

specifies a time limit for the write concern. This is only applicable for minNumberOfWrites values greater than 1.

j

if set to true, servers will block until write operations have been committed to the journal. Cannot be used in combination with fsync. Prior to MongoDB 2.6 this option was ignored if the server was running without journaling. Starting with MongoDB 2.6 write operations will fail with an exception if this option is used when the server is running without journaling.

fsync

If set to true and the server is running without journaling, blocks until the server has synced all data files to disk. If the server is running with journaling, this acts the same as the j option, blocking until write operations have been committed to the journal. Cannot be used in combination with j.

Source
WriteConcern.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WriteConcern
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
Implicitly
  1. by StringFormat
  2. by Ensuring
  3. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new WriteConcern(minNumberOfWrites: Option[Int] = Some(1), writeMode: Option[String] = None, timeout: FiniteDuration = Duration.Zero, j: Option[Boolean] = Some(true), fsync: Option[Boolean] = None)

    minNumberOfWrites

    how many servers should confirm a write before the operation is considered successful. When set to 0 - requests no acknowledgment of the write operation. If you also set waitForAcknowledge to true, that prevails to request acknowledgment from the standalone mongod or the primary of a replica set. When set to 1 - requests acknowledgment that the write operation has propagated to the standalone mongod or the primary in a replica set. This is the default. When set to greater than 1 - requires acknowledgment from the primary and as many additional data-bearing secondaries to meet the specified value. For example, consider a 3-member replica set with no arbiters. Specifying 2 would require acknowledgment from the primary and one of the secondaries. Specifying 3 would require acknowledgment from the primary and both secondaries.

    writeMode

    When set to "majority" - requests acknowledgment that write operations have propagated to the calculated majority of the data-bearing voting members (i.e. primary and secondaries with members[n].votes greater than 0). When set to a custom write concern name - Requests acknowledgment that the write operations have propagated to tagged members that satisfy the custom write concern defined in settings.getLastErrorModes. This takes priority over minNumberOfWrites.

    timeout

    specifies a time limit for the write concern. This is only applicable for minNumberOfWrites values greater than 1.

    j

    if set to true, servers will block until write operations have been committed to the journal. Cannot be used in combination with fsync. Prior to MongoDB 2.6 this option was ignored if the server was running without journaling. Starting with MongoDB 2.6 write operations will fail with an exception if this option is used when the server is running without journaling.

    fsync

    If set to true and the server is running without journaling, blocks until the server has synced all data files to disk. If the server is running with journaling, this acts the same as the j option, blocking until write operations have been committed to the journal. Cannot be used in combination with j.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def ->[B](y: B): (WriteConcern, B)
    Implicit
    This member is added by an implicit conversion from WriteConcern toArrowAssoc[WriteConcern] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def ensuring(cond: (WriteConcern) => Boolean, msg: => Any): WriteConcern
    Implicit
    This member is added by an implicit conversion from WriteConcern toEnsuring[WriteConcern] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  8. def ensuring(cond: (WriteConcern) => Boolean): WriteConcern
    Implicit
    This member is added by an implicit conversion from WriteConcern toEnsuring[WriteConcern] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: Boolean, msg: => Any): WriteConcern
    Implicit
    This member is added by an implicit conversion from WriteConcern toEnsuring[WriteConcern] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean): WriteConcern
    Implicit
    This member is added by an implicit conversion from WriteConcern toEnsuring[WriteConcern] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from WriteConcern toStringFormat[WriteConcern] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  14. val fsync: Option[Boolean]
  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. val j: Option[Boolean]
  18. val minNumberOfWrites: Option[Int]
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. def productElementNames: Iterator[String]
    Definition Classes
    Product
  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. val timeout: FiniteDuration
  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  28. val writeMode: Option[String]

Deprecated Value Members

  1. def [B](y: B): (WriteConcern, B)
    Implicit
    This member is added by an implicit conversion from WriteConcern toArrowAssoc[WriteConcern] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion StringFormat fromWriteConcern to StringFormat[WriteConcern]

Inherited by implicit conversion Ensuring fromWriteConcern to Ensuring[WriteConcern]

Inherited by implicit conversion ArrowAssoc fromWriteConcern to ArrowAssoc[WriteConcern]

Ungrouped