title: How do I mongoexport attributes from an array of objects to CSV?
body: <p>I need to export values of objects in an array to CSV. Let's say my document is:</p>
  
  <pre>
  {
      name:"test",
      types:[
          {type:"A"},
          {type:"B"},
                  {type:"C"}
      ]
  }
  </pre>
  
  <p>My goal is to produce output like:</p>
  
  <pre>
  "test", "A"
  "test", "B"
  "test", "C"
  </pre>
  
  <p>The following would also be acceptable:</p>
  
  <pre>
  "test", "A,B,C"
  </pre>
  
  <p>I'm trying to accomplish this via mongoexport using:</p>
  
  <pre>mongoexport -h localhost -d mydb -c mycollection -f name,types.type --csv</pre>
  
  <p>Unfortunately, I'm getting:</p>
  
  <pre>"test",</pre>
  
  <p>I've found documentation on referencing specific array elements, like "types.0.type", but the length of my array is unknown. Any ideas?</p>