var question = new Schema({
question: String,
answer: [{ body: String}]
})
在数据库中添加'答案'?
编辑: -
我正在尝试: - 但它说: - Cannot apply $push/$pushAll modifier to non-array
questionModel.findByIdAndUpdate(ans.id,
{ $push: { answer: { body: ans.answer.body} } },
function(err){ if(err){
console.log(err)
} else {
console.log('Added')
}
});