-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow setting ReadPreference at a Repository and Query level [DATAMONGO-2103] #2971
Labels
in: repository
Repositories abstraction
status: ideal-for-contribution
An issue that a contributor can help us with
type: enhancement
A general enhancement
Milestone
Comments
spring-projects-issues
added
in: repository
Repositories abstraction
type: enhancement
A general enhancement
labels
Dec 30, 2020
christophstrobl
added
the
status: ideal-for-contribution
An issue that a contributor can help us with
label
Jul 6, 2023
Hi @christophstrobl If there is no problem, I would like to contribute. |
@jorgerod I cleared the assignee, happy to review a PR. Please make sure to check out our contribution guidelines. |
jorgerod
added a commit
to jorgerod/spring-data-mongodb
that referenced
this issue
Sep 14, 2023
jorgerod
added a commit
to jorgerod/spring-data-mongodb
that referenced
this issue
Sep 14, 2023
…itory' of https://github.com/jorgerod/spring-data-mongodb into feature/spring-projectsGH-2971-read-preference-at-repository
christophstrobl
pushed a commit
that referenced
this issue
Oct 3, 2023
christophstrobl
added a commit
that referenced
this issue
Oct 12, 2023
…ethods. This commit reduces the API surface of the ReadPreference annotation leaving fine grained control such as Tags to the Template API. Next to supporting read preference for annotated queries we now also make sure to apply read preferences for annotated aggregation methods as well as predefined finder methods running queries. See: #2971 Original Pull Request: #4503
christophstrobl
added a commit
that referenced
this issue
Oct 12, 2023
Limit exposure of API methods to package visibility. Also remove fields and methods not directly required to support current feature scope. Finally add missing since tags and provide additional tests. See: #2971
christophstrobl
added a commit
that referenced
this issue
Oct 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: repository
Repositories abstraction
status: ideal-for-contribution
An issue that a contributor can help us with
type: enhancement
A general enhancement
João Carvalho opened DATAMONGO-2103 and commented
Currently, setting the
ReadPreference
can only be done at theMongoTemplate
level. This forces us to move down an abstraction layer to specify customReadPreference
s for our entities and queries.We would like to be able to specify the
ReadPreference
for an entity at the Repository and Query level. Our current use case involves a specific entity which can be accessed from a secondary node node in the majority of the use cases, but requires primary reads for other use cases. As our applications scale, it becomes critical to distribute load across all nodes in the MongoDB cluster, and currently, we can either change the global level (thus sacrificing correctness) or providing custom implementations on a repository-by-repository basis.This could be achieved using an annotation, like such:
In this example, all queries to this entity (both builtin an custom) would use the 'Secondary Preferred' level, except for
strongFindByName
, which would use the 'Primary' level.1 votes, 2 watchers
The text was updated successfully, but these errors were encountered: