-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Description
When using the method is in the Criteria class together with any other filter element (without the and operator), then the created filter document is invalid.
Relevant code:
Lines 947 to 950 in 5b86b2f
if (!NOT_SET.equals(isValue)) { | |
queryCriteria.put(this.key, this.isValue); | |
queryCriteria.putAll(document); | |
} else { |
How to reproduce
The following Criteria object
Criteria.where("name")
.is(123)
.type(JsonSchemaObject.Type.INT_64)
creates
{"name": 123, "$type": ["long"]}
which is invalid.
Using the following Criteria object
Criteria.where("name")
.in(123)
.type(JsonSchemaObject.Type.INT_64)
creates
{"name": {"$in": [123], "$type": ["long"]}}
which is valid and more or less the same, just does not use "is".
Expected
When using is in combination with other filters for the same property, all filters should be combined into a sub-document using $eq for the equality check of the value provided to the is method.
Criteria.where("name")
.is(123)
.type(JsonSchemaObject.Type.INT_64)
should create
{"name": {"$eq": 123, "$type": ["long"]}}
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug