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

Link copied to clipboard

The query is sent to the primary node in the replica set.

Link copied to clipboard

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.

Link copied to clipboard

The query is sent only to secondary members of the replica set.

Link copied to clipboard

The query is sent to the secondary members of the replica set.

Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

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.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.