0

I find this to be very common, but lack the background knowledge to understand why this is done over relational.

{
  post_id: 123,
  text: 'hi',
  created_at: 1497832162891,
  comments: [
    comment_id: 456,
    text: 'hey',
    created_at: 1497832162892,
    nestedComments: [...],  // which also have nested comments
  ],
}

Doesn't this get pretty awkward if you have a larger number of nested comments? Is it hard or slow to delete one?

Isn't it a better practice most of the time to just have the posts and comments in different collections, with the comments containing the parent id to "join" them, so you basically end up doing relational with NoSQL anyway?

Another example is what if you have a scenario like "users watch this show". If the show ends up being removed from the NoSQL database, wouldn't it be difficult to remove all instances of that show leftover in the user's embedded shows data?

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
atkayla
  • 8,143
  • 17
  • 72
  • 132
  • This is a faq. What have you found? Please google 'stackoverflow.com nosql vs sql' and read many hits. The "relational" answers are the most informed. SQL is for generic querying with certain performance & certain special case optimizations, and NoSQL systems (the term is a catch-all) are specialized for particular cases. Eg see my answers re ['nosql'](https://stackoverflow.com/a/44212536/3404097). – philipxy Jun 19 '17 at 04:05
  • Please try attending M101P or M101J first week and you will get better view. – love gupta Jun 19 '17 at 04:18
  • 1
    I'm in general agreement with the comments. The "broad" question is already covered. If you believe you are actually asking something more specific, then change your question to just ask that specific thing **only**. As it stands, if there was not already a direct answer, then this question would still be closed for being far too opinion based. – Neil Lunn Jun 19 '17 at 07:09

0 Answers0