중첩 된 세트 (예 : 주석 트리)를 MongoDB에 저장하는 가장 좋은 방법은 무엇입니까?MongoDB 중첩 세트
모든 댓글에는 부모 댓글과 아동 댓글 (답변)이있을 수 있습니다.
이처럼 저장 : 우리는, 예를 들어,지도없이 "베드로 주석 모든 포스트"를 요청 할 수 없기 때문에
{
title: "Hello",
body: "Please comment me!",
comments: [
{
author: "Peter",
text: "Hi there",
answers: [
{
author: "Peter",
text: "Hi there",
answers: [
{ author: "Ivan", text: "Hi there" },
{ author: "Nicholas", text: "Hi there" }
]
},
{ author: "Ivan", text: "Hi there" },
{ author: "Nicholas", text: "Hi there" },
]
},
{ author: "Ivan", text: "Hi there" },
{ author: "Nicholas", text: "Hi there" },
]
}
는 멋진하지 않습니다/줄일 수 있습니다.