[SERVER-5530] Date range queries beyond Unix epoch time fail. Created: 06/Apr/12  Updated: 11/Jul/16  Resolved: 06/Apr/12

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 1.8.2
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: David Ellis Assignee: Unassigned
Resolution: Done Votes: 0
Labels: buildbot
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 11.10


Operating System: Linux
Participants:

 Description   

Very simple to replicate. Create a collection with a document containing a current date. Then do a simple: ``db.collection.find({dateField: {$gte: new Date("1/1/1969")})`` and it won't find the document. Do it with "1/1/1970" and it will, so it appears that the internal ranging doesn't properly handle negative epoch time (perhaps treating the value as an unsigned rather than signed integer?).

I originally chose "1/1/1900" as the date to query from when I'm initially populating an Apache Solr server with data from my MongoDB database for easier fuzzy matching, and was surprised that nothing was found. I don't know if this is Linux specific or not, since all of my development has been on various Linux distros.

I personally have my solution (1900 was chosen at a whimsy, so I can replace it with something else, like 1/1/1984), but I don't like the idea that something as intrinsic to DBs as date querying could be wrong, so I wanted to let you know.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 06/Apr/12 ]

This was fixed for 2.0
See: SERVER-405

Generated at Thu Feb 08 03:09:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.