Home:ALL Converter>Mongo: document find on date

Mongo: document find on date

Ask Time:2015-09-09T17:30:18         Author:NIKHIL RANE

Json Formatter

Here its my mongodb database structure

coordinates : {
    lat : {type: Number},
    lon : {type: Number},

},
timeStamp :{type: Date} ,
accuracy :{type: Number},
deviceId : {type: Number},
deviceType : {type: String},
simId : {type: String}

I want to find document on date.

here its my query for getting document from mongodb

db.LocationInfoCollection.find({"deviceId":911441051085656,"timeStamp":{$gte:new Date("2015-09-07T12:56:44.000Z")}})

when I'm run above query on mongodb return blank array.

Above query perfectly run on mongo shell. But not in my code.

output on mongo shell

  {

    "timeStamp": "2015-09-08T12:31:24.000Z",
    "accuracy": 5,
    "deviceId": 911441051085656,
    "simId": "123456",
    "_id": "55eed361dfa115387dade3ce",
    "coordinates": {
      "lat": 20.998,
      "lon": 75.5667
    }
  }

How can I get document on above date query.

Author:NIKHIL RANE,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/32475902/mongo-document-find-on-date
yy