我想不出一种方法来创建一个合适的模式来处理帖子、评论和回复。主要停留在我将如何处理评论回复上。基本上就像reddit,他们发帖然后回复,你可以回复每个人的回复
视觉评论
(假设他们都在带有标题的帖子页面上回复)
const CommentSchema = new mongoose.Schema({
username: {
type: String,
required: true,
},
detail: {
type: String,
required: true,
},
})
const PostSchema = new mongoose.Schema({
author: {
type: String,
required: true,
},
title: {
type: String,
required: true
},
description: {
type: String,
required: true
},
comments: [CommentSchema]
})
Run Code Online (Sandbox Code Playgroud)
我制作的上述架构不处理对其他评论的响应。我还可以如何处理回复?