Contents
How to avoid reading from secondaries in MongoDB?
Use the maxStalenessSeconds option to avoid reading from secondaries that the client estimates are overly stale. Starting in version 4.4, primaryPreferred supports hedged reads on sharded clusters. Operations read only from the secondary members of the set. If no secondaries are available, then this read operation produces an error or exception.
When to use hedged reads on MongoDB clusters?
Starting in version 4.4, secondary supports hedged reads on sharded clusters. In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary on sharded clusters.
What’s the memory limit for blocking sort in MongoDB?
allowDiskUse() allows MongoDB to use temporary files on disk to store data exceeding the 100 megabyte system memory limit while processing a blocking sort operation. Changed in version 4.4 : For MongoDB 4.2 and prior, blocking sort operations could not exceed 32 megabytes of system memory.
Is there a way to monitor a MongoDB instance?
MongoDB provides various methods for collecting data about the state of a running MongoDB instance: Starting in version 4.0, MongoDB offers free Cloud monitoring for standalones and replica sets. MongoDB distributes a set of utilities that provides real-time reporting of database activities.
How does read preference affect MongoDB causal consistency?
Read preference does not affect causal consistency. The causal consistency guarantees provided by causally consistent sessions for read operations with “majority” read concern and write operations with “majority” write concern hold across all members of the MongoDB deployment. All read operations use only the current replica set primary. [ 1]
How to query MongoDB secondary replica set members?
By calling rs.slaveOk () you are indicating to the system that you acknowledge that reads will be eventually consistent and wish to be able to query the secondary anyway.