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

mongoimport imports longs as integers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: Legacy C++ Implementation
    • Fix Version/s: 2.8.0-rc0
    • Component/s: mongoimport
    • Labels:
    • Environment:
      osx 10.9.4
      mongo 2.6.2

      Description

      mongoexport creates a json with type information, but longs get converted to integers when mongoimport reads data back in

      This is a problem for java, where types matter.

      Create a long
      > db.export.insert(

      {longNum:NumberLong(123)}

      )

      mongoexport --collection export > export.json
      mongoimport --collection import < export.json

      In a mongo shell, look at the export and import collections
      > db.import.find()

      { "_id" : ObjectId("54136bda945c5f71c6d2897f"), "longNum" : 123 }

      > db.export.find()

      { "_id" : ObjectId("54136bda945c5f71c6d2897f"), "longNum" : NumberLong(123) }

      The import collection shows the number as in integer instead of a long. The export.json does show the longNum being exported as a $numberLong but the importer fails to respect that.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kristi Kristi Tsukida
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: