Mongodb – threshold replica lag for secondaryPrefered mongod

mongodbreplication

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?

Best Answer

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?