Class ReadPreference

The ReadPreference class is a class that represents a MongoDB ReadPreference and is used to construct connections.

Constructors

Properties

hedge?: HedgeOptions
maxStalenessSeconds?: number
minWireVersion?: number
tags?: TagSet[]
nearest: ReadPreference = ...
NEAREST: "nearest" = ReadPreferenceMode.nearest
primary: ReadPreference = ...
PRIMARY: "primary" = ReadPreferenceMode.primary
PRIMARY_PREFERRED: "primaryPreferred" = ReadPreferenceMode.primaryPreferred
primaryPreferred: ReadPreference = ...
secondary: ReadPreference = ...
SECONDARY: "secondary" = ReadPreferenceMode.secondary
SECONDARY_PREFERRED: "secondaryPreferred" = ReadPreferenceMode.secondaryPreferred
secondaryPreferred: ReadPreference = ...

Accessors

Methods

  • Check if the two ReadPreferences are equivalent

    Parameters

    • readPreference: ReadPreference

      The read preference with which to check equality

    Returns boolean

  • Validate if a mode is legal

    Parameters

    • Optionalmode: string

      The string representing the read preference mode.

    Returns boolean

  • Validate if a mode is legal

    Parameters

    • mode: string

      The string representing the read preference mode.

    Returns boolean