title: Mongodb export nested field
body: <p>I have a MongoDB and I want to export to a .csv file.</p>
  
  <p>document:</p>
  
  <pre><code>{
    "id" : 28,
    "organisation" : "Mickey Mouse company",
    "country" : "US",
    "contactpersons" : [{
        "title" : "",
        "typecontact" : "D",
        "mobilenumber" : "757784854",
        "firstname" : "Mickey",
        "lastname" : "Mouse",
        "emailaddress" : "mickey@mouse.com"
      }],
    "modifieddate" : "2013-11-21T16:04:49+0100"
  }
  </code></pre>
  
  <p>I want to export all document and only want the field contactpersons.firstname and contactpersons.emailaddress</p>
  
  <p>I use this commandline:</p>
  
  <pre><code>     mongoexport -o /tmp/export.csv -host dbmongo -port 27017 -db organisation -collection organisationa -u user -p password -csv  -fields 'contactpersons.0.firstname, contactpersons.0.emailaddress'
  </code></pre>
  
  <p>This works more or less, it exports but only exports the field firstname and not emailaddress. I need it also the export the field emailaddress.</p>
  
  <p>Any idea how I can do this? I don't understand why it doesn't work even though I do give the  emailaddress field. Do error is given.</p>
  
  <p>Thanks for any help!</p>