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

mongoimport imports longs as integers

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

      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.

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

              Created:
              Updated:
              Resolved: