Package com.mongodb
Class TransactionOptions.Builder
- java.lang.Object
-
- com.mongodb.TransactionOptions.Builder
-
- Enclosing class:
- TransactionOptions
public static final class TransactionOptions.Builder extends Object
The builder for transaction options
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransactionOptions
build()
Build the transaction options instance.TransactionOptions.Builder
readConcern(ReadConcern readConcern)
Sets the read concern.TransactionOptions.Builder
readPreference(ReadPreference readPreference)
Sets the read preference.TransactionOptions.Builder
writeConcern(WriteConcern writeConcern)
Sets the write concern.
-
-
-
Method Detail
-
readConcern
public TransactionOptions.Builder readConcern(@Nullable ReadConcern readConcern)
Sets the read concern.- Parameters:
readConcern
- the read concern- Returns:
- this
-
writeConcern
public TransactionOptions.Builder writeConcern(@Nullable WriteConcern writeConcern)
Sets the write concern.- Parameters:
writeConcern
- the write concern, which must be acknowledged- Returns:
- this
-
readPreference
public TransactionOptions.Builder readPreference(@Nullable ReadPreference readPreference)
Sets the read preference.- Parameters:
readPreference
- the read preference, which currently must be primary. This restriction may be relaxed in future versions.- Returns:
- this
-
build
public TransactionOptions build()
Build the transaction options instance.- Returns:
- The
TransactionOptions
-
-