java - MongoDB accessing query for date is not working -


i storing following object in menus collection. make following query , doesn't find records. please help.

thanks in advance.

>> menu.java     private string menuid;     private date startdate;     private date enddate;  >> store.java     dbcollection collection = db.getcollection(collectiontype);     string jsonstring = new gson().tojson(object);     dbobject dbobj = (dbobject) json.parse(jsonstring);     collection.save(dbobj);  >> string generated {"menuid":"1","startdate":"jul 12, 2013 8:52:48 am","enddate":"jul 22, 2013 8:52:48 am"}  >> query defined startdate < currentdate < enddate     basicdbobject query = new basicdbobject("startdate", new basicdbobject("$lte", abstractjson.getdate(days))).append("enddate", new basicdbobject("$gte", abstractjson.getdate(days)));  { "startdate" : { "$lte" : { "$date" : "2013-07-17t13:02:56.697z"}} , "enddate" : { "$gte" : { "$date" : "2013-07-17t13:02:58.510z"}}} 

thanks miguel. decided store time in long value. ok.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -