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

mongoimport should have the option to skip a malformed json to continue the import

    XMLWordPrintable

Details

    • Task
    • Status: Accepted
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      Hello,

      If the JSON file contains a document with an invalid JSON document, the import will fail and it won't skip it to continue. It think it is a good default behaviour, but there are some cases where it is ok to skip the malformed document and continue the import.

      For example:

      {"_id":{"$oid":"5d0262232553044cf43488fc"},"name":"\"}
      {"_id":{"$oid":"5d0262232553044cf43488fd"},"name":"hehe"}
      

      It fails with:

      Failed: error processing document #1: invalid character '\n' in string literal

      This ticket is to ask for a mongoimport command line option that allows the tool to skip "invalid character" errors and continue with the next documents. Of course, those errors should be logged anyway.

      Attachments

        Activity

          People

            backlog-server-tools Backlog - Server Tools Team
            miguel.nieto@mongodb.com Miguel Angel Nieto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: