我的模式是
branch_name: {type: String},
semester_name: [{
semester: {type: String},
subject: [{
subject_name: {type: String}
}]
}]
,结果来自前端-
{
branch: 'it',
semester: '5',
subject: [
{ subject_name: 'math' },
{ subject_name: 'bio' }
]
}
我的用于插入代码的Api是-
const new_branch = new Branch({
branch_name: data.branch,
semester_name: [{
semester: data.semester,
subject: [{
subject_name: data.subject.subject_name
}]
}]
});
new_branch.save((err,result) =>{
console.log(err);
console.log(result);
});
如何存储使用者名称。
我尝试了很多方法,但仍然无法正常工作