Example: 3 node on RS with mongos and mongoc(cluster)

On one Secondary node(on RS) we have replica lag, e.g. - 1h.
So, if my read preference is - secondaryPrefered and if I read data from RS, can it happen that I will read data from a node that has a replication lag?
Or does mongodb have some sort of protection mechanisms?


Yes, the data you read from SECONDARY might not be up-to-date. The obvious solution if you are no fine with it: read from the PRIMARY.

However, one hour sounds a lot. Did you configure a Delayed Member or did you configure storage.oplogMinRetentionHours?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.