I have the following documents in collection
{
"_id" : ObjectId("53202b3644aec3ce32afc40b"),
"_class" : "com.brand.domain.House",
"bedrooms" : 2,
"uid" : "URErlrjldVhW",
"price" : NumberLong(200),
"type" : "RENT",
"address" : " test",
"details" : " test",
"rentType" : "perMonth"
}
{
"_id" : ObjectId("53202b4444aec3ce32afc40c"),
"_class" : "com.brand.domain.House",
"bedrooms" : 2,
"uid" : "SHvPruOJuivg",
"price" : NumberLong(300),
"type" : "RENT",
"address" : " ",
"details" : " ",
"rentType" : "perMonth"
}
And with the following query using query builder, it returns empty array
My input values are
type : RENT
maxPrice : 5000
minPrice : 100
bedRooms : 2
And the query
Query query = new Query(
where("type")
.is(form.getType())
.and("price")
.lte(form.getMaxPrice())
/*.gte(form.getMinPrice())*/
.and("bedRooms")
.is(form.getMinBedRooms()));
And following are form fields
private String type;
private long minPrice;
private long maxPrice;
private int minBedRooms;
Can any one kindly help me what is wrong with my query. Thanks in advance.