spring-projects / spring-projects/spring-data-mongodb
Introduce ability to append queries against a particular collection [DATAMONGO-1151]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Heiko Scherrer opened DATAMONGO-1151 and commented
Task description
I request a feature that I couldn't find in the current implementation. Probably there's another elegant way to solve the requested behaviour. I need to append all queries to a particular collection with a specific criteria. Think about a multi-tenancy scenario where a discriminator property (holding the tenants name) has to be compared in each query. Doing this within application code is cumbersome and error-prone. IMO this should be applied somewhere deep in the framework, at best near to execution.
Investigation
I had a look at MongoTemplate and implemented a solution with a so called QueryAppender, that is able to add a criteria to a query (for a collection). Unfortunately MongoTemplate uses several alternatives within the finder methods. Some work with Query, others with DBObjects. So before opening Pandoras Box and implementing too many changes within MongoTemplate, I wanted to clarify that my approach might be a solution and no other solution already exists.
Affects: 1.6.2 (Evans SR2)
Issue Links:
-
DATACMNS-293 Add infrastructure for generic query augmentation
("depends on") -
DATAJPA-307 Add support for soft deletes
-
DATAJPA-564 Support for SpEL based parameter expressions in repository query methods
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.