Get the App
SLTechnology News&Howtos  ›  Database  › 

Characteristics of mongodb database (including database field design for comments and likes)

Shulou Source: shulou.com Published: 2022-06-01 13:27:22 10月04日 Update

The biggest difference between mongo and traditional databases is:

Traditional database: structured data, after determining the table structure, the content of each row must be in line with the table structure, that is to say-the number of columns, the type is the same.

Mongo document database: each document under the table can have its own unique structure (json objects can have their own unique properties and values)

Idea: if there is a movie, film review, film review reply, reply score

In the traditional database, at least 4 tables are needed, and the correlation degree is very complex.

In the document database, it can be completed through 1 document. It reflects the anti-normalization of the document database.

{

Fiim:' The Demi-Gods & Semi-Devils'

Comment: [

{

The movie style of content:' Wong Kar-wai

Reply: ['support', 'good']

}

]

}

Comment and like menu structure of traditional data tables:

(it will be very complicated)

Mongodb, on the other hand, is a tree structure, which is very clear:

(no matter how deep it is, it can be very clear.)

Tags: Data database structure documents traditional traditional complex unique film reviews movies reviews different maximum row number relevance content function menu The Demi-Gods & Semi-Devils Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL Apple Huawei Docker