Package com.mongodb

Enum Class ReadConcernLevel

java.lang.Object
java.lang.Enum<ReadConcernLevel>
com.mongodb.ReadConcernLevel
All Implemented Interfaces:
Comparable<ReadConcernLevel>, java.lang.constant.Constable

public enum ReadConcernLevel extends Enum<ReadConcernLevel>
A read concern level allows clients to choose a level of isolation for their reads.
Since:
3.2
MongoDB documentation
3.2
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The available read concern level.
    The linearizable read concern level.
    The local read concern level.
    The majority read concern level.
    The snapshot read concern level.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromString(String readConcernLevel)
    Returns the ReadConcern from the string read concern level.
     
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Enum

    equals, name, valueOf

    Methods inherited from class java.lang.Object

    wait, wait
  • Enum Constant Details

    • LOCAL

      public static final ReadConcernLevel LOCAL
      The local read concern level.
    • MAJORITY

      public static final ReadConcernLevel MAJORITY
      The majority read concern level.
    • LINEARIZABLE

      public static final ReadConcernLevel LINEARIZABLE
      The linearizable read concern level.

      This read concern level is only compatible with ReadPreference.primary().

      Since:
      3.4
      Since server release
      3.4
    • SNAPSHOT

      public static final ReadConcernLevel SNAPSHOT
      The snapshot read concern level.
      Since:
      3.8
      Since server release
      4.0
    • AVAILABLE

      public static final ReadConcernLevel AVAILABLE
      The available read concern level.
      Since:
      3.9
      Since server release
      3.6
  • Method Details

    • values

      public static ReadConcernLevel[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ReadConcernLevel valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
      Returns:
      the String representation of the read concern level that the MongoDB server understands
    • fromString

      public static ReadConcernLevel fromString(String readConcernLevel)
      Returns the ReadConcern from the string read concern level.
      Parameters:
      readConcernLevel - the read concern level string.
      Returns:
      the read concern