【发布时间】:2021-12-09 15:17:37
【问题描述】:
我在后端使用猫鼬,想知道这样设置数组类型的架构属性是否正确?:
comments: {
type: [],
required: false,
}
然后像这样推送到具有相同属性的文档?:
thread.comments.push({
commenter: req.user.username,
content: comment,
});
thread.save();
【问题讨论】:
标签: javascript node.js mongoose mern react-fullstack