Mongodb returns empty array with query builder -
i have 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 following query using query builder, returns empty array
my input values
type : rent maxprice : 5000 minprice : 100 bedrooms : 2 and 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 form fields
private string type; private long minprice; private long maxprice; private int minbedrooms; can 1 kindly me wrong query. in advance.
isn't "query" sping data class? then:
query searchquery = new query(criteria.where("type") .is("rent") .and("price") .lte(5000) .and("bedrooms") .is(2)); system.out.println( searchquery ); printing or logging object me see doing want.
Comments
Post a Comment