Package com.mongodb
Class ReadConcern
java.lang.Object
com.mongodb.ReadConcern
A read concern allows clients to choose a level of isolation for their reads.
- Since:
- 3.2
- MongoDB documentation
- Read Concern
- Since server release
- 3.2
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ReadConcern
The available read concern.static final ReadConcern
Use the servers default read concern.static final ReadConcern
The linearizable read concern.static final ReadConcern
The local read concern.static final ReadConcern
The majority read concern.static final ReadConcern
The snapshot read concern. -
Constructor Summary
-
Method Summary
-
Field Details
-
DEFAULT
Use the servers default read concern. -
LOCAL
The local read concern. -
MAJORITY
The majority read concern. -
LINEARIZABLE
The linearizable read concern.This read concern is only compatible with
ReadPreference.primary()
.- Since:
- 3.4
- Since server release
- 3.4
-
SNAPSHOT
The snapshot read concern.- Since:
- 3.8
- Since server release
- 4.0
-
AVAILABLE
The available read concern.- Since:
- 3.9
- Since server release
- 3.6
-
-
Constructor Details
-
ReadConcern
Construct a new read concern- Parameters:
level
- the read concern level
-
-
Method Details
-
getLevel
Gets the read concern level.- Returns:
- the read concern level, which may be null (which indicates to use the server's default level)
- Since:
- 3.6
-
isServerDefault
public boolean isServerDefault()- Returns:
- true if this is the server default read concern
-
asDocument
Gets this read concern as a document.- Returns:
- The read concern as a BsonDocument
-
equals
-
hashCode
public int hashCode()
-