Skip to content

Introduce ability to append queries against a particular collection [DATAMONGO-1151] #2067

Open
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions