Reputation: 559
I want to set read preference to my 3-member replica set. How to configure it using spring.data.mongodb.uri from java driver. I want to set "secondary preferred" read preference.
Upvotes: 2
Views: 3033
Reputation: 146
I haven't used Spring Data much, but you can set replica set location and read preferences using MongoDB's Connection String:
mongodb://example1.com,example2.com,example3.com/?readPreference=secondary
This link explains more about the MongoDB Connection String.