请查看我收藏的文档结构:
{
"_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"
}
我想打印要在列中显示的所有嵌套属性。但我做不到,请你帮忙。
最佳答案
将嵌套选项值设置为 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.
关于node.js - 在node js中获取mongodb集合数据到csv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36281433/