Mongoexport should not interpret '\n' within a field as an actual newline.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.0.4
    • Component/s: Tools
    • None
    • ALL
    • Hide

      Create a JSON document that includes '\n' within the middle of a string and watch the string get split over two lines when the document is exported to csv.

      Show
      Create a JSON document that includes '\n' within the middle of a string and watch the string get split over two lines when the document is exported to csv.
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Hi,

      Hopefully this is not a duplicate. I did not manage to find any similar tickets.

      I know there is no clear guidance on this within rfc4180, but to me it makes sense that a '\n' within a CSV field should not be interpreted as an actual new line when writing out to a csv file. Perhaps converting it to '
      n' instead of creating a new line. Have you guys had any discussion about this previously?

      JSON:
      "app": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<string>Sprint Zone</string>\n</plist>\nSprint Zone",
      
      CSV:
      "<?xml version=""1.0"" encoding=""UTF-8""?>
      <!DOCTYPE plist PUBLIC ""-//Apple//DTD PLIST 1.0//EN"" ""http://www.apple.com/DTDs/PropertyList-1.0.dtd"">
      <plist v..."
      

      My export command.

      mongoexport -h ${hostname} -d ${database} -c ${collection} -u ${mongo_user} -p ${mongo_password} --csv --out ${filename}-${current}.csv --fieldFile fieldFile --query "{REMOVED}"
      

      mongoexport version 2.0.4

            Assignee:
            Stennie Steneker (Inactive)
            Reporter:
            Gerric Chaplin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: