Skip to content

Fix expression defining entire query in annotated repository methods #3907

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

Closed
wants to merge 7 commits into from

Conversation

rolag-it
Copy link
Contributor

@rolag-it rolag-it commented Dec 7, 2021

This fix enables defining an entire JSON-based query in @Query and @Aggregate annotations use a single parameter or SpEL Expression.

Examples:

 @Query("?0")
 List<Thing> findByComplexFilters(String jsonQuery);

 
 @Query("?#{[0].build()}")
 List<Thing> findByComplexFilters(MyComplexQueryBuilder jsonQueryBuilder);

christophstrobl and others added 4 commits November 11, 2021 10:00
…s computed entirely via expression.

This commit makes sure the extension collector returns a marker object to indicate no further json parsing is required.
This fix enables defining an entire JSON-based query in Query and Aggregate annotations using a single parameter or SpEL Expression.
Replace calls to deprecated methods. Remove unsed variables. Optimize imports.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 7, 2021
@rolag-it rolag-it changed the title Fix expression defining entire query in annotated repositories method Fix expression defining entire query in annotated repository methods Dec 9, 2021
@rolag-it
Copy link
Contributor Author

I just found the related issue #3874 fixed by @christophstrobl. My fix adds immediate expression result parsing as org.bson.Document and a few unit tests. I think that the two approaches can be combined.

@rolag-it
Copy link
Contributor Author

Hello @christophstrobl, I just merged your pull request, please take a look when you can. Thanks

@christophstrobl
Copy link
Member

Thank you @rolag-it! We'll have a look (might take some time due to the upcoming holiday season though).

Changed condition for Document parsing only when expression return a String
@christophstrobl
Copy link
Member

thanks @rolag-it!

christophstrobl pushed a commit that referenced this pull request Jan 20, 2022
This fix enables defining an entire JSON-based query in Query and Aggregate annotations using a single parameter or SpEL Expression.

Resolves: #3871
Original Pull Request: #3907
christophstrobl added a commit that referenced this pull request Jan 20, 2022
Add tests and move json string treatment into the ParameterBindingDocumentCodec.
Finally add issue references and format code.

Original Pull Request: #3907
@christophstrobl
Copy link
Member

Merged to main development line via (a8a0fb5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants