Uploaded image for project: 'MongoDB ETL Tools'
  1. MongoDB ETL Tools
  2. TOOLS-1871

Mongoexport of Array fields to CSV

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Trivial - P5
    • Resolution: Works as Designed
    • Affects Version/s: 3.4.7
    • Fix Version/s: None
    • Component/s: mongoexport
    • Labels:
      None
    • Environment:
      Win8.1x64

      Description

      I wanted to export a array to a csv file using mongoexport utility without mentioning the Index number.

      E.g. mongoexport -d test -c tech --type=csv --out fields_tech.csv --fields skills.0,skills.1

      From above example am using something like skills.0,skills.1

      Since i know the length of the array am able to give the index values for export.

      In few cases the length of the array is so big i cannot give the index number while exporting.

      Is there any way to import all the array values to a csv without mentioning the index numbers.

      Array:
      "skills" : [ "java","dotnet","testing" ]

      Expected output
      skills
      java
      dotnet
      testing

      I have tried $unwind option but wanted to know if it is possible directly using mongoexport

        Attachments

          Activity

            People

            • Assignee:
              david.golden David Golden
              Reporter:
              Rajasekhara_J Raja sekhara reddy javvaji
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: