MongoDB does a comment system, how to design the structure of the data table?

the general comment system goes like this:

comments on articles-> comments on articles-> comments on comments. Using mysql, there are two tables, articles and comments. Comments on articles and comments on comments are stored in one table, comments.

question:
so how do you design the data table structure to do the same thing with mongodb?

Mar.30,2021

mongo is a good place to do such a thing, with a comment structure at the bottom of the article.

general structure:

{
    title: String,
    content: String,
    createTime: DateTime,
    comments: [
        userName: String,
        // JSON(
        content: String 
    ] 
}

but it depends on the demand.

    Whether the
  1. comment appears as a separate concept. Such as some statistics for comments.
  2. whether comments are infinitely nested.
  3. whether comments need to be modified frequently, such as like.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37768-2c0a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37768-2c0a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?