我有这个架构:
let answersSchema = new mongoose.Schema({
answerId: {
type: Number,
required: true
},
answerTitle: {
type: String,
required: true
}
});
let individualQuestionsSchema = new mongoose.Schema({
questionId: {
type: Number,
required: true
},
type: {
type: String,
required: true
},
questionTitle: {
type: String,
required: true
},
answers: [answersSchema]
});
let questionSchema = new mongoose.Schema({
questions: [individualQuestionsSchema]
});
使用mongoose我想查询我的集合中的所有数据。当我执行:
QuestionMongo.findOne().exec((err, res) => {
logger.debug(res);
});
这是输出:
{
_id: 5948eec705bb435feafb0d48,
questions:
[
{
questionId: 1,
questionTitle: 'Question01',
answerType: 'radio',
answers: [Object]
},
{
questionId: 2,
questionTitle: 'Question02',
answerType: 'radio',
answers: [Object]
}
]
}
为什么出现[对象]而不是它应该显示的内容?