ReadPreference¶
enum ReadPreference : Enum<ReadPreference>
The read preference allows configuring which instance the request will be sent to.
Operations which do not specify a read preference are sent to the primary node.
External resources¶
Entries¶
Primary¶
The query is sent to the primary node in the replica set.
PrimaryPreferred¶
The query is sent to the primary node in the replica set. If the primary node is not available (e.g. during a failover), the operation reads from secondary nodes.
Secondary¶
The query is sent only to secondary members of the replica set.
SecondaryPreferred¶
The query is sent to the secondary members of the replica set.
Nearest¶
The driver reads from a member whose network latency falls within the acceptable latency window. The driver does not take into account whether that member is a primary or secondary.
Properties¶
bsonName¶
entries¶
val entries: EnumEntries<ReadPreference>
Returns a representation of an immutable list of all enum entries, in the order they're declared.
This method may be used to iterate over the enum entries.
name¶
ordinal¶
Functions¶
valueOf¶
fun valueOf(value: String): ReadPreference
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Throws
IllegalArgumentException-
if this enum type has no constant with the specified name
values¶
fun values(): Array<ReadPreference>
Returns an array containing the constants of this enum type, in the order they're declared.
This method may be used to iterate over the constants.