8

Working:

 .\mongoexport.exe --db mydb --collection slideproof_user_event_date_count --csv --out 
events.csv --fields '_id,first_day'
 .\mongoexport.exe --db mydb --collection slideproof_user_event_date_count --out 
events.json --fields '_id._p,first_day'

Not working (only first field/column has content) written, :

 .\mongoexport.exe --db mydb --collection slideproof_user_event_date_count --csv --out 
events.csv --fields '_id._p, first_day'

How can I enable correct output for .csv with subdocument fields?

Cilvic
  • 3,417
  • 2
  • 33
  • 57

1 Answers1

22

The solution is to avoid spaces in the --fields argument:

this works:

--fields '_id._p,value.count'

This does not:

--fields '_id._p, value.count'
Cilvic
  • 3,417
  • 2
  • 33
  • 57