Skip to content

Better syntax for OR/AND Criterias [DATAMONGO-317] #1250

Closed
@spring-projects-issues

Description

@spring-projects-issues

Sergey Alaev opened DATAMONGO-317 and commented

To create query {$or: [{'a': 1}, {'b', 2}]} I need to write following code:

Criteria crit1 = Criteria.where("a").is(1);
Criteria crit2 = Criteria.where("b").is(2);
Query query = Query.query(new Criteria().orOperator(crit1, crit2));

I believe it is a good idea to add static or/and factory methods to cover above case and provide a simple way to convert Critera to Query

Something like that:
Query query = Criteria.or(authorCrit, workersCrit).query();


Affects: 1.0 M5

2 votes, 3 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core supportstatus: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions