I inserted a document in MongoDB like:
db.test.insert({date:20150101});
When I tried to use db.test.find({date:"20150101"})
to search it (date string with double quote), no results were returned.
Only when I use db.test.find({date:20150101})
, it returns a result. It seems MongoDB will strictly compare the date value.
Is there any way that I can search it with either double quote version or numeric version?