Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2328

4.2.0-rc2 mongoimport doesn't support ISODate values without --legacy option

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      When trying to mongoimport a json file that contains an ISODate field, the import will fail from a 4.2.0rc2 mongoimport.

      The same file will succeed using 4.0.10, 3.6.13, 3.4.21.

      λ 4.0.10\mongoimport.exe -d test -c test1 --type json --file date-isodate.json
      2019-07-04T15:14:38.167-0400    connected to: localhost
      2019-07-04T15:14:38.184-0400    imported 1 document
      
      λ 4.0.10\mongoimport.exe -d test -c test2 --type json --file date-$date.json
      2019-07-04T15:14:49.767-0400    connected to: localhost
      2019-07-04T15:14:49.781-0400    imported 1 document
      
      λ 4.2.0rc2\mongoimport.exe -d test -c test3 --type json --file date-isodate.json
      2019-07-04T15:15:47.474-0400    connected to: mongodb://localhost/
      2019-07-04T15:15:47.777-0400    Failed: invalid JSON input. Position: 23. Character: I
      2019-07-04T15:15:47.778-0400    0 document(s) imported successfully. 0 document(s) failed to import.
      
      λ 4.2.0rc2\mongoimport.exe -d test -c test4 --type json --file date-$date.json
      2019-07-04T15:15:54.554-0400    connected to: mongodb://localhost/
      2019-07-04T15:15:54.868-0400    1 document(s) imported successfully. 0 document(s) failed to import.
      

      The second test replaces ISODate with "$date": "YYYY-MM-DDTHH:MM:SS.nnnZ" and succeeds in 4.2.0rc2.

      Tested on 4.2.0rc2 for Windows. Test files attached.

        1. date-isodate.json
          0.1 kB
        2. date-$date.json
          0.1 kB

            Assignee:
            Unassigned Unassigned
            Reporter:
            alex.bevilacqua@mongodb.com Alex Bevilacqua
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: