spring-data-mongodb icon indicating copy to clipboard operation
spring-data-mongodb copied to clipboard

Add isNull() to ComparisonOperators

Open sathish256 opened this issue 6 months ago • 0 comments

Adds an additive isNull() builder to ComparisonOperators (and its Eq operator) so a field or expression can be compared to null in aggregation expressions:

ComparisonOperators.valueOf("qty").isNull(); // { $eq: [ "$qty", null ] }

This renders to the output requested in the issue and avoids the previous workaround of passing a null-returning expression (equalTo(ctx -> null)). The existing equalToValue(...) contract (which rejects null) is left unchanged.

A unit test is added in ProjectionOperationUnitTests (// GH-3473).

Closes #3473

sathish256 avatar Jun 03 '26 19:06 sathish256