MongoDB export to CSV -
i have met small problem, don't know wrong..>.<, want export data csv file, seem cannot export, maybe syntax error :(
this mongo data
"wfm_votelog" : { "wfm_test@abc_com" : { "classname" : "com.abc.com.shared.activiti.processapproval", "approver" : "wfm.test@abc.com", "approvaltime" : isodate("2012-08-16t08:59:43.297z"), approvalstate" : "approved" } }
and my export query
$ mongoexport.exe --db wfm --collection audittrail --csv -fields variables.wfm_votelog.classname
i believe problem come "wfm_test@abc_com"
, dont know how bypass field.
sadly, can't mongoexport.
mongoexport.exe --db wfm --collection audittrail --csv -fields variables.wfm_votelog.0.classname
this output rows of audittrail
collection, , each row/document put classname
propery only of first *wfm_votelog*.
the problem here mongoexport doesn't extract array document. export 1 value each document
you can ugly things like:
mongoexport.exe --db wfm --collection audittrail --csv -fields 'variables.wfm_votelog.0.classname,variables.wfm_votelog.1.classname,variables.wfm_votelog.2.classname,...'
Comments
Post a Comment