Date comparison in mongodb -


i want retrieve documents after particular date. database has date - dateadded:"2014-12-17 10:03:46.000z"

i wrote following query-

db.collection.find({dateadded:{"$lte":new date("2015-06-17 10:03:46.000z")}}) 

but results doesn't fetches record though there records dates upto 2015-06-24.

you can use isodate compare dates:

"$lte" : isodate("2015-06-17t10:03:46z") 

isodate works because format date in.

new date()  

wraps date in isodate helper, not able convert in query.

check out link more information: http://docs.mongodb.org/manual/core/shell-types/


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

excel vba - VBA Proxy auto-configuration for http requests -

php - phpWord - Tables with borders in headers/footers -