将mongodb集合数据提取到节点js中的csv

时间:2016-03-29 10:16:28

标签: node.js mongodb csv

请查看我的收藏品的文件结构:

{
"_id": "9759572745-Sing",
 "details": {
"Gender": "M",
"PreTrainingStatus": "Fresher",
"Religion": "Hindu",
"attendanceInPercentage": "",
"batchHolders": {
    "AssessmentDate": "Thu Jul 16 2015",
    "CourseFee": "7500",
    "isEditable": false
},
"batchID": "282726",
"eid": "",
"whereDidYouHearAboutStar": "---Select---",
"skillInstructorOrTrainerName": "282726",
"specificGovtInstitutetieups": "---Select---",
"isSelected": false,
"isEditable": false
},
"addedOnMs": 1439455766000,
"submittedOnMs": 1439454813000,
"latitude": "27.409566879272",
"longitude": "77.69295501709",
"locationName": "Uttar Pradesh 281006,null"
}

我想打印要在列中显示的所有嵌套属性。但是我无法这样做,请你帮忙。

1 个答案:

答案 0 :(得分:1)

将嵌套选项值设置为true

Specify fields that you want from JSON. 
For nested document you can specify like this batchHolders.AssessmentDate (it will give you "Thu Jul 16 2015") and so on for others also.