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

Show the line data and line number details on mongoimport error

    XMLWordPrintable

    Details

      Description

      I have a "room for improvement" item regarding mongoimport error messaging.
      There was an error in the JSON file that threw the error shown below. EX:

      { "_id" : "10004", "city" : "New York", "state" : "NY" }

      { "_id" : "10005", "city" : "New York",

      We need a way to know the line content and the
      line number of the data where the error occurred as this current format
      doesn't provide that. Maybe its buried in the Hex output. If I have a zillion lines of JSON, I need to know where to go to fix the data. Shouldn't be that hard to say:
      ERROR at line 2
      ERROR CONTENT: { "_id" : "10005", "city" : "New York",

      Fri Oct 21 07:56:03 Assertion: 10340:Failure parsing JSON string
      near: ,
      0x5847a2 0x528af4 0xa95ba3 0xa97e53 0xa8e98d 0xa92922 0x7f62007de30d
      0x4fd0c9
      mongoimport(_ZN5mongo11msgassertedEiPKc+0x112) [0x5847a2]
      mongoimport(_ZN5mongo8fromjsonEPKcPi+0x444) [0x528af4]
      mongoimport(_ZN6Import8parseRowEPSiRN5mongo7BSONObjERi+0x8b3)
      [0xa95ba3]
      mongoimport(_ZN6Import3runEv+0x16e3) [0xa97e53]
      mongoimport(_ZN5mongo4Tool4mainEiPPc+0x169d) [0xa8e98d]
      mongoimport(main+0x32) [0xa92922]
      /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)
      [0x7f62007de30d]
      mongoimport(__gxx_personality_v0+0x3e1) [0x4fd0c9]
      exception:Failure parsing JSON string near: ,

        Attachments

          Activity

            People

            Assignee:
            backlog-server-platform Backlog - Platform Team
            Reporter:
            ian.whalen Ian Whalen
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: