Answer the question
In order to leave comments, you need to log in
How to search deep into a structure?
there is an articles structure, comments are built into it, you need to find a specific comment and insert another comment into its children:
{
_id:"Some ID",
text:"Some Article",
comments:[
{
"_id":"some comment id1",
"text":"some comment",
"parent":"Some ID",
"comments":[
{
"_id":"some comment id2",
"text":"some comment",
"parent":"some comment id1",
"comments":[
{
...
}
]
}
]
},
{
"_id":"some comment id3",
"text":"some comment",
"parent":"Some ID",
"comments":[
{
...
}
]
}
Answer the question
In order to leave comments, you need to log in
If you need to access comments directly (by id), then you should move them to a separate collection, or to one "linear" level, so that it would be possible to do this. And with your structure, only write the entire block, or build a point query on this structure.
PS: Why do you need parent in a comment if it is already in some comment (already has ownership)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question