Skip to content

Add support for $expr to Criteria query. [DATAMONGO-1845] #2750

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
spring-projects-issues opened this issue Jan 9, 2018 · 2 comments
Closed
Assignees
Labels
in: core Issues in core support type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Christoph Strobl opened DATAMONGO-1845 and commented

Allow usage of Aggregation expressions in filter queries using $expr.

db.monthlyBudget.find( { $expr: { $gt: [ "$spent" , "$budget" ] } } )

Reference URL: https://docs.mongodb.com/manual/reference/operator/query/expr/

3 votes, 3 watchers

@petitcl
Copy link
Contributor

petitcl commented Apr 1, 2021

What about adding an exprOperator method to Criteria that accepts an AggregationExpression and behave like orOperator and andOperator ? It allows to reuse all the aggregation operators already defined in spring-data-mongodb.

public Criteria exprOperator(AggregationExpression expression)

The example above could be written like this:

Criteria criteria = new Criteria()
    .exprOperator(
        ComparisonOperators.Gt
              .valueOf("spent")
              .greaterThan("budget")
    );

@davidb-e4s
Copy link

opened over 4 years ago...would be good to get this.

@mp911de mp911de closed this as completed in a416441 Mar 6, 2023
mp911de pushed a commit that referenced this issue Mar 6, 2023
Favor Base64 over deprecated Base64Utils.

See: #2750
Original pull request: #4316.
mp911de added a commit that referenced this issue Mar 6, 2023
Reformat code.

See #2750
Original pull request: #4316
@mp911de mp911de added this to the 4.1 M3 (2023.0.0) milestone Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants