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

Mongoexport of Array fields to CSV

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

      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

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

              Created:
              Updated:
              Resolved: