So I need to get all records that start_date is greater than current date. Here’s my mongo db shell
and here’s my meteor function
"getReservations" : function(token, time) {
var userId = isUserTokenValid(token);
if(userId == -1) {
throw new Meteor.Error(401, 'Error 401: Unauthorized', 'token is not valid');
}
var reservationsList = Collections.Reservation.find({id_Tag: userId}, {start_date: {$gt: new Date(time).toISOString()}}).fetch();
console.log("time is = " + time);
console.log("result time is = " + reservationsList[0].start_date);
return reservationsList;
}
So here’s my time variable 1493030819753. However I get all the records from my database. Here’s my result
[{"_id":"3rwLqkmYm28WxCjxP","start_date":{"$date":1493026620000},"expire_date":{"$date":1493077020000},"status":"Accepted","station_id":"119024","id_Tag":"1950972025131636"},{"_id":"F7pr3yBRANT2Qi4Tv","start_date":{"$date":1493160600000},"expire_date":{"$date":1493163420000},"status":"Accepted","station_id":"118755","id_Tag":"1950972025131636"}]
So what I’m missing?