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

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            miguel.nieto@mongodb.com Miguel Angel Nieto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: