spring-data-mongodb
spring-data-mongodb copied to clipboard
Add isNull() to ComparisonOperators
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