Enum mongodb::options::ReadPreference[][src]

pub enum ReadPreference {
    Primary,
    Secondary {
        options: ReadPreferenceOptions,
    },
    PrimaryPreferred {
        options: ReadPreferenceOptions,
    },
    SecondaryPreferred {
        options: ReadPreferenceOptions,
    },
    Nearest {
        options: ReadPreferenceOptions,
    },
}
Expand description

Specifies how the driver should route a read operation to members of a replica set.

If applicable, tag_sets can be used to target specific nodes in a replica set, and max_staleness specifies the maximum lag behind the primary that a secondary can be to remain eligible for the operation. The max staleness value maps to the maxStalenessSeconds MongoDB option and will be sent to the server as an integer number of seconds.

See the MongoDB docs for more details.

Variants

Primary

Only route this operation to the primary.

Secondary

Only route this operation to a secondary.

Show fields

Fields of Secondary

options: ReadPreferenceOptions
PrimaryPreferred

Route this operation to the primary if it’s available, but fall back to the secondaries if not.

Show fields

Fields of PrimaryPreferred

options: ReadPreferenceOptions
SecondaryPreferred

Route this operation to a secondary if one is available, but fall back to the primary if not.

Show fields

Fields of SecondaryPreferred

options: ReadPreferenceOptions
Nearest

Route this operation to the node with the least network latency regardless of whether it’s the primary or a secondary.

Show fields

Fields of Nearest

options: ReadPreferenceOptions

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.