The setting you are looking for is called read-preference. If you look at the doc here , you will find:
hibernate.ogm.mongodb.read_preference
Specifies ReadPreference to use when reading data in a MongoDB data warehouse. Possible settings (ReadPreferenceType enumeration values): PRIMARY, PRIMARY_PREFERRED, SECONDARY, SECONDARY_PREFERRED and NEXT.
In this case, you are likely to use SECONDARY_PREFERRED, which in fact means that the read operation will by default be redirected to the subordinate nodes, but sleep mode will return to primary if it is the only available node.
source
share