Uploaded image for project: 'MongoDB ETL Tools'
  1. MongoDB ETL Tools
  2. TOOLS-874

Mongoimport $date close to epoch not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.0.5
    • Fix Version/s: 3.1.7, 3.0.7
    • Component/s: mongoimport
    • Labels:
      None
    • Environment:
      Debian 7
    • Sprint:
      Kernel Tools 8 08/28/15

      Description

      Hi,

      I'm working on importing data with dates before and after epoch.
      I use a timestamp (ms) with $date like this :

      {"date":{"$date":1287205428000}}
      

      It works great, gives me a document like this :

      {
      	"_id" : ObjectId("55ca240b026ec36b031a720c"),
      	"date" : ISODate("2010-10-16T05:03:48Z")
      }
      

      It also works great with negative timestamps (before epoch).

      However, I ran into some timestamps that created problems.
      For timestamps corresponding to dates between 1969-12-07 and 1970-01-25, mongoimport will throw this exception :

      Failed: error getting extended BSON for document #0: invalid type for $date field
      

      The document used to generate this error is :

      {"date":{"$date":2136800000}}
      

      or

      {"date":{"$date":-2136800000}}
      

      mongoimport -d test -c test --drop < date.json
      

      Fyi, with this timetamp (juste a day after) it's working :

      {"date":{"$date":2236800000}}
      

      I didn't find any other ticket about this specific problem.

      Regards

        Attachments

          Activity

            People

            • Assignee:
              shraya.ramani Shraya Ramani
              Reporter:
              b.dieder@prismamedia.com Bastien Diederichs
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: