Node.js + MongoDB Comments/Subcomments Implementation Method

Asked 2 years ago, Updated 2 years ago, 106 views

In Node.js, the express framework-based database uses MongoDB.

However, it was not as easy as I thought how to implement the comments and subcomments.

Can I get advice from people who have implemented or experienced these features?

node.js back-end javascript mongodb

2022-09-22 18:39

1 Answers

Your question is about one-to-many relationship.

One post can have multiple comments and each comment can have multiple comments. However, one comment does not have multiple posts, and likewise, one comment cannot have multiple comments and sub-comments. So if you refer to the official document or these articles, you can roughly organize them like this.


2022-09-22 18:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.