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:
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"]}}