{"action":"closed","issue":{"url":"https://api.github.com/repos/meteor/meteor/issues/5839","labels_url":"https://api.github.com/repos/meteor/meteor/issues/5839/labels{/name}","comments_url":"https://api.github.com/repos/meteor/meteor/issues/5839/comments","events_url":"https://api.github.com/repos/meteor/meteor/issues/5839/events","html_url":"https://github.com/meteor/meteor/issues/5839","id":123114391,"number":5839,"title":"Minimongo - Collection.find() does not allow a proper date query","user":{"login":"methodbox","id":12660440,"avatar_url":"https://avatars.githubusercontent.com/u/12660440?v=3","gravatar_id":"","url":"https://api.github.com/users/methodbox","html_url":"https://github.com/methodbox","followers_url":"https://api.github.com/users/methodbox/followers","following_url":"https://api.github.com/users/methodbox/following{/other_user}","gists_url":"https://api.github.com/users/methodbox/gists{/gist_id}","starred_url":"https://api.github.com/users/methodbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/methodbox/subscriptions","organizations_url":"https://api.github.com/users/methodbox/orgs","repos_url":"https://api.github.com/users/methodbox/repos","events_url":"https://api.github.com/users/methodbox/events{/privacy}","received_events_url":"https://api.github.com/users/methodbox/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-12-19T22:29:33Z","updated_at":"2015-12-29T23:08:25Z","closed_at":"2015-12-29T23:08:25Z","body":"Per Mongo docs, storing a date in ISODate format allows a front-end query on the dates using \r\n\r\n``` \r\nnew Date(\"date\")\r\n```\r\nHowever, it doesn't appear to actually work for Meteor on the front-end/minimongo as such a query returns an undefined set of ALL documents:\r\n\r\n```\r\nTrackers.find({callDate: {$gte: new Date(\"Dec 10, 2015\"), $lte: new Date(\"Dec 12, 2015\")}})\r\n```\r\n\r\nThis returns:\r\n\r\n```\r\nL…n.Cursor {collection: LocalCollection, sorter: null, matcher: M…o.Matcher, _selectorId: undefined, skip: undefined…}_projectionFn: (obj)_selectorId: undefined_transform: nullcollection: LocalCollectionfields: undefinedlimit: undefinedmatcher: Minimongo.Matcherreactive: trueskip: undefinedsorter: null__proto__: LocalCollection.Cursor\r\n```\r\n....in the browser console, which suggests Minimongo can't do a proper date range query.\r\n\r\nI can do the same in from Mongo shell:\r\n\r\n```\r\n\r\nmeteor:PRIMARY> db.trackers.find({callDate: {$gte: new Date(\"Dec 10, 2015\"), $lte: new Date(\"Dec 12,\r\n 2015\")}})\r\n{ \"_id\" : \"Tp6FDghY5DmAFqkmA\", \"leadFirstName\" : \"Date\", \"leadLastName\" : \"Time\", \"repFirstName\" : \"\r\nTime\", \"repLastName\" : \"Date\", \"callDate\" : ISODate(\"2015-12-10T06:00:00Z\"), \"callTime\" : \"12:00PM\",\r\n \"greetingCheck\" : false, \"validateCheck\" : false, \"virtualHandshake\" : false, \"clarifyReiterate\" :\r\nfalse, \"clarifyRespond\" : false, \"clarifyConfirm\" : false, \"setExpectCheck1\" : false, \"setExpectChec\r\nk2\" : false, \"setExpectCheck3\" : false, \"setExpectCheck4\" : false, \"consultCheck1\" : false, \"consult\r\nCheck2\" : false, \"consultCheck3\" : false, \"maintenanceCheck\" : false, \"concernsCheck\" : false, \"trac\r\nkerNotes\" : \"      \" }\r\n```\r\n\r\nAnd a proper set of documents is returned. I can verify by selecting only \"Dec 10th, 2015\":\r\n\r\n```\r\nmeteor:PRIMARY> db.trackers.find({callDate: {$gte: new Date(\"Dec 10, 2015\"), $lt: new Date(\"Dec 12,\r\n2015\")}})\r\n{ \"_id\" : \"Tp6FDghY5DmAFqkmA\", \"leadFirstName\" : \"Date\", \"leadLastName\" : \"Time\", \"repFirstName\" : \"\r\nTime\", \"repLastName\" : \"Date\", \"callDate\" : ISODate(\"2015-12-10T06:00:00Z\"), \"callTime\" : \"12:00PM\",\r\n \"greetingCheck\" : false, \"validateCheck\" : false, \"virtualHandshake\" : false, \"clarifyReiterate\" :\r\nfalse, \"clarifyRespond\" : false, \"clarifyConfirm\" : false, \"setExpectCheck1\" : false, \"setExpectChec\r\nk2\" : false, \"setExpectCheck3\" : false, \"setExpectCheck4\" : false, \"consultCheck1\" : false, \"consult\r\nCheck2\" : false, \"consultCheck3\" : false, \"maintenanceCheck\" : false, \"concernsCheck\" : false, \"trac\r\nkerNotes\" : \"      \" }\r\n```\r\n\r\nI cannot make the same work from the front-end. I've console.log'd my results when using a date field for the start and end dates and it still returns a generic, undefined set of documents.\r\n\r\nJust for good measure, here's a search using Dec 15-Dec 16th. My DB currently only has docs from Dec 10th and Dec 16th, so only the 16th docs should return:\r\n\r\n```\r\nmeteor:PRIMARY> db.trackers.find({callDate: {$gte: new Date(\"Dec 15, 2015\"), $lte: new Date(\"Dec 16,\r\n 2015\")}})\r\n{ \"_id\" : \"euLP9aJHMcRAC4wuA\", \"leadFirstName\" : \"Date\", \"leadLastName\" : \"Time\", \"repFirstName\" : \"\r\nTime\", \"repLastName\" : \"Date\", \"callDate\" : ISODate(\"2015-12-16T06:00:00Z\"), \"callTime\" : \"12:00PM\",\r\n \"greetingCheck\" : false, \"validateCheck\" : false, \"virtualHandshake\" : false, \"clarifyReiterate\" :\r\nfalse, \"clarifyRespond\" : false, \"clarifyConfirm\" : false, \"setExpectCheck1\" : false, \"setExpectChec\r\nk2\" : false, \"setExpectCheck3\" : false, \"setExpectCheck4\" : false, \"consultCheck1\" : false, \"consult\r\nCheck2\" : false, \"consultCheck3\" : false, \"maintenanceCheck\" : false, \"concernsCheck\" : false, \"trac\r\nkerNotes\" : \"      \" }\r\n{ \"_id\" : \"We9u8aaCiJedATMDu\", \"leadFirstName\" : \"Date\", \"leadLastName\" : \"Time\", \"repFirstName\" : \"\r\nTime\", \"repLastName\" : \"Date\", \"callDate\" : ISODate(\"2015-12-16T06:00:00Z\"), \"callTime\" : \"12:00PM\",\r\n \"greetingCheck\" : false, \"validateCheck\" : false, \"virtualHandshake\" : false, \"clarifyReiterate\" :\r\nfalse, \"clarifyRespond\" : false, \"clarifyConfirm\" : false, \"setExpectCheck1\" : false, \"setExpectChec\r\nk2\" : false, \"setExpectCheck3\" : false, \"setExpectCheck4\" : false, \"consultCheck1\" : false, \"consult\r\nCheck2\" : false, \"consultCheck3\" : false, \"maintenanceCheck\" : false, \"concernsCheck\" : false, \"trac\r\nkerNotes\" : \"      \" }\r\n```\r\nDigging into the \"undefined\" set returned by minimongo, you can clearly see all documents (all 3 of them) are returned:\r\n\r\n```\r\n_map: Object\r\nTp6FDghY5DmAFqkmA: Object\r\nWe9u8aaCiJedATMDu: Object\r\neuLP9aJHMcRAC4wuA: Object\r\n```"}}