MongoDB comparing dates only without times -


how query date field in mongodb date only, , not times? example, if mongodb stores july 7, 2015 any time, want match day today's date.

in mysql, select col1, col2 table date(date_field) = date(now());

notice how mysql has function change date_field date during matching. can in mongodb similar function during matching? collection.find({ dateonly(datetimefield): dateonly(new date() }); or of like?

i understand mongo stores date/times in gmt, have convert stored gmt date+time gmt local before matching date only, me started, know if can strip time off of date match. example, if gmt july 8 @ 03:00 local eastern time july 7 @ 23:00 want match july 7.

i guess should make range query between start of day , ending(or without ending if talking today). this

db.collection.find({   "date" : {"$gte": new date("2015-07-07t00:00:00.000z"),           "$lt": new date("2015-07-08t00:00:00.000z")} }) 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -