Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9015

Mongoimport for TSVs does not understand types correctly

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Tools
    • Labels:
      None
    • ALL

      Mongoimport has flaws in how it handles TSV files, particularly regarding the types of data that are imported.

      A simple example to demonstrate:

      1) Start with the following sample file represented the exported document

      { a : true }

      $cat test.tsv
      a
      true

      2) Import this file
      $mongoimport -d test -c test -f a --type tsv --file test.tsv --headerline

      3) Look at the document
      $mongo
      >db.test.find()

      { "_id" : ObjectId("5147741f12da7a6b27ff5c58"), "a" : "true" }

      This document has the value "true" the string, rather than true the boolean.

      A issues exists for importing subdocuments where what is imported is a string representation of the subdocument rather than an actual subdocument.

      Beyond this, if a string is stored like "string" (where the value is what is inside the quotes), the imported value will be "\"string\"".

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrew.emil@10gen.com Andrew Emil (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: