-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add readPreference secondaryPreferred to QueryCursorPreparer #3669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you want to customize |
How can I set a different ReadPreference for a single query? |
You could override |
When I override the prepareCollection I can't set the read preference for a single query and i can't set the read preference for an annotation based query, because these queries are using the mongo template implizit. |
Let me take your request to our team to check whether we can come up with something. For |
HI, |
Right now, we do not have the means to configure |
Hey @mp911de, adding some more info that might be useful here. We have a similar use case where we would like to set the read preference per query (basically we always read from the secondary, but when we don't find anything we then try to read from the primary). |
And why does the SECONDARY_READS cursor option return a primaryPreferred() ReadPreference? Maybe I am missing something.. can anyone explain |
Fixed via #4286. |
Hello,
we will execute find queries on the secondaries in our mongo cluster, but the CursorOption SECONDARY_READS is mapped to primaryPreferred in MongoTemplate.QueryCursorPreparer.getReadPreference. The mapping isn't customizable and the code isn't extendable by subclassing the MongoTemplate.
Please add a mapping for CursorOption SECONDARY_PREFRERRED with secondaryPreferred.
Kind regards
Peter
The text was updated successfully, but these errors were encountered: