0

I am trying to fetch data from MongoDB where ((this.Day.toDateString() ==new Date('03/05/2013 01:10:00').toDateString()) but it MongoDB not displaying proper data.

so if anyone have any solution regarding

  • Possible duplicate of [Find objects between two dates MongoDB](http://stackoverflow.com/questions/2943222/find-objects-between-two-dates-mongodb) – Blakes Seven Mar 18 '16 at 08:37
  • That means that even "one day" is actually a "range" of dates. From begining of the day until the start of the next. It also means that "Dates" are "Dates", and not "strings". – Blakes Seven Mar 18 '16 at 08:37

1 Answers1

0

If You are using mongo db 3.2 then you can use $eq operator to compare your dates and you can Use Date() to convert your date to sring.

Tamil Arasi
  • 179
  • 5
  • but I am using this with MapReduce in MongoVUE. Example: in where condition I m using ((this.Day.toDateString() ==new Date('03/05/2013 01:10:00').toDateString()) This query display result of all 03/05/2013 but not displaying only one result. I want only one result of '03/05/2013 01:10:00' datetime – user2475345 Mar 18 '16 at 11:21
  • I Think you can use findOne() to retrive only 1 result or you can use aggregate function along with project operator to project only 1 record along with the criteria – Tamil Arasi Mar 18 '16 at 12:51