MongoDB use document as basic storage unit. A document is just a simple JSON like object.
title, content and comments
In relational model, the comment will be stored as an individual table and retrieved by join post table and comment table. In document model, they are saved as one document. They are treated as a whole. When query, you just get that one document, that one document can be identified by an id. Thus get a document is a key value query, not a relational query. Key value query is much faster than relational query.
"denormalization". Its a process that aggragate data from different tables in to one table to avoid join operations. Some database programmers sometimes denormalize database structure intentionally to gain performance. That exactly what MongoDB document is doing.
댓글 없음:
댓글 쓰기