Skip to content
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 to pass custom Query to MongoRepository [DATAMONGO-2610] #3465

Closed
spring-projects-issues opened this issue Aug 17, 2020 · 2 comments
Closed
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Aug 17, 2020

Oleh Kurpiak opened DATAMONGO-2610 and commented

add following method to MongoRepository

import org.springframework.data.mongodb.core.query.Query;

List<T> findAll(Query query)

No further details from DATAMONGO-2610

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Aug 20, 2020

Oleh Kurpiak commented

Could someone please review this?
#882

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Oct 13, 2020

Mark Paluch commented

Spring Data Repositories aim to be technology-agnostic (CrudRepository) so that the caller doesn't have to deal with store-specific API. Introducing a method that accepts Query violates such a rule.

One could also argue that MongoRepository breaks this rule in the first place as it already defines methods that aren't available on CrudRepository and their claim is true. However, we don't want to follow that path of introducing additional store-specifics as at some time the interface would end as collection query methods.

Instead, we suggest using MongoTemplate directly. Alternatively, implement custom repository fragments that you add to one/multiple repositories in your code if you don't need to adhere to a strict technology separation.

@spring-projects-issues spring-projects-issues added status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants