I'm trying to save the data in the array of fields uisng node js , but here database is showing with the empty fileds , what i'm doing wrong here. please help me thanks in advance
schema Design:-
module.exports = mongoose => {
const Question = mongoose.model(
"question",
mongoose.Schema(
{
roleType : { type:String },
questions : [{
question : { type:String },
options : [{ type:String }]
}]
})
)
return Question;
};
code:-
const { roleType, question, options } = req.body
const questionList = new Question ({
roleType: roleType,
questions: [{
question:question,
options: options
}],
});
questionList.save(questionList)
postman i'm passing data like this:-
database is storing like this:-

