问题描述
const Notification = Schema({
read: Boolean
receiver: {
type: Schema.Types.ObjectId,ref: "User"
}
label: String
});
const User = Schema({
email: String,password: String,notifications: [{
type: Schema.Types.ObjectId,ref: "Notification"
}]
});
这里我有一个Notification
模式和User
模式,我想知道在Notification
文档中存储User
id是正确的方法。鉴于User
是不受限制的,我应该在Notification
文档中存储Notification
id吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)