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

Avoid scientific notation in export of large doubles

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 3.2.8
    • Fix Version/s: 3.4.0
    • Component/s: mongoexport
    • Environment:
      OS X El Capitan
      MongoDB v3.2.8 (via macports)
    • Backport Requested:
      v3.2, v3.0
    • Documentation Changes:
      Needed
    • Sprint:
      Platforms 2017-01-23

      Description

      I have been trying to export data to CSV with integer ID values that are stored as doubles.

      Unfortunately, the larger numbers are exported in scientific notation, which means that either the ID is no longer accurate due to a decrease in significant digits, or that the target DB cannot interpret the numbers as it cannot parse scientific notation.

      It would be very useful to have one of two options:

      1) Something like a --toString option that simply converts all values to strings. They are typically not surrounded by quotations, so can easily be interpreted in any manner by another tool.

      2) An equivalent to the --fieldFile option where the data format can be specified.

      Currently I have to run scripts that do something like:

      db.collection.find().forEach(function(item)

      { item.clientID = '' + item.clientID db.tmpcollection.insert(item) }

      )

      and then export the temporary collection.

      If implemented, there would need to be changes to the documentation for mongoexport describing the solution.

        Attachments

          Activity

            People

            • Assignee:
              gabriel.russell Gabriel Russell
              Reporter:
              Bullitt Frank Ortmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: