1
我有以下的猫鼬架构的定义...更新猫鼬子文档集合
var BlogSchema = new Schema({
content: String,
comments:[CommentSchema], //embed the comments
owner: {type: ObjectId , ref: 'User'}
})
var CommentSchema = new Schema({
commentContent : String,
commentPostTime : Number,
likes : [{type: ObjectId , ref: 'User'}],
likeCount: {type: Number, default:0}
})
var UserSchema = new Schema({
})
当用户喜欢评论。应将用户添加到喜好列表中,并且应更新Blog文档中嵌入的评论子文档。我不知道如何实现这一点。
帮助表示赞赏。