Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-5530

Date range queries beyond Unix epoch time fail.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.8.2
    • Component/s: Querying
    • Labels:
    • Environment:
      Ubuntu 11.10
    • Linux

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            isv_damocles David Ellis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: