我正在向 Meteor blaze 模板发布一些数据,我想返回特定字段,但它是一个带有嵌套数组/对象的复杂对象,所以我不知道该怎么做
这是我要发布的对象的示例
{
"_id": "q9i6qAZmKcf6MCPE2",
"name": "Exam Name",
"questions": [
{
"number": 1,
"question": "Question 1",
"multipleTrue": false,
"answers": [
{
"letter": "a",
"answer": "Blah Blah",
"correct": false <--------------
},
{
"letter": "b",
"answer": "Blah Blah",
"correct": true <--------------
}
]
},
{
"number": 2,
"question": "Question 2",
"multipleTrue": false,
"answers": [
{
"letter": "a",
"answer": "Blah Blah",
"correct": true <--------------
},
{
"letter": "b",
"answer": "Blah Blah",
"correct": true <--------------
}
]
}
]
}
我使用以下代码发布此内容:
return Assessments.find( {"name": "Exam Name"}, {fields: {name: 1, questions: 1}});
如何修改该出版物以排除我用箭头突出显示的键“正确”?
问题数组 > 问题对象 > 答案数组 > 答案对象 > 正确键