Skip to content

ComparisonOperators.Lte seems to match undefined/null value in switch caseOperator #3791

Open
@Strat1987

Description

@Strat1987

ComparisonOperators.Lte seems to match undefined/null value in switch caseOperator

reactiveMongoTemplate.upsert(Query.query(
                                Criteria.where("id").is(b.getId())
                        ), AggregationUpdate.update()
                                .set("field.value").toValue(
                                        ConditionalOperators.switchCases(
                                                        CaseOperator.when(Gte.valueOf("field_priority")
                                                                        .greaterThanEqualToValue(b.getField().getPriority()))
                                                                .then("gte"),                                                
                                                        CaseOperator.when(Lte.valueOf("field_priority")
                                                                       .lessThanEqualToValue(b.getField().getPriority()))
                                                                .then("lt")
                                                )
                                                .defaultTo("default")
                                ), Bar.class)).flatMap(c -> Mono.just(foo));

if there is no document in the database we expect to run the default case, however we see the lte case is being ran.
We've tried fiddling with the order and gt, lt methods but none of them seem to accomplish what we're after.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions