// student document
{
_id : 'ohnamju_01',
name : 'ohnamju'
}
// account document
{
account_id : 'ohnamju_01',
balance : 0,
}
/* 자주 account 정보에서 name이 필요하다면, */
{
_id : 'ohnamju_01',
name : 'ohnamju'
balance: 0
}
- 문제점 : 필요하지 않은 데이터도 load 시켜 read를 수행할 때 느려질 수 있음.
the most frequently-accessed portion of the data should go in the collection that the application loads first.
제일 중요한 점은 우리 어플리케이션이 어떻게 데이터를 사용하는지에 초점을 맞춰서 설계하는 것
예시) movie 와 movie detail로 나누자
// movie collection
{
"id" : 1,
"title" : "The Arrival of a Train",
"year" : 1895,
"runtime" : 1,
"released" : IsoDate("1895-01-25")
"type": "movie",
"directors": [ "Auguste Lumière", "Louis Lumière" ],
"countries": [ "France" ],
"genres": [ "Documentary", "Short" ],
}
// movie_details collection
{
"_id": 156,
"movie_id": 1, // reference to the movie collection
"poster": "http://ia.media-imdb.com/images/M/MV5BMjEyNDk5MDYzOV5BMl5BanBnXkFtZTgwNjIxMTEwMzE@._V1_SX300.jpg",
"plot": "A group of people are standing in a straight line along the platform of a railway station, waiting for a train, which is seen coming at some distance. When the train stops at the platform, ...",
"fullplot": "A group of people are standing in a straight line along the platform of a railway station, waiting for a train, which is seen coming at some distance. When the train stops at the platform, the line dissolves. The doors of the railway-cars open, and people on the platform help passengers to get off.",
"lastupdated": ISODate("2015-08-15T10:06:53"),
"imdb": {
"rating": 7.3,
"votes": 5043,
"id": 12
},
"tomatoes": {
"viewer": {
"rating": 3.7,
"numReviews": 59
},
"lastUpdated": ISODate("2020-01-29T00:02:53")
}
}
[React] Virtual-DOM, Reconciliation, fiber (0) | 2021.06.21 |
---|---|
[MongoDB] Model Relationships Between Documents (3) (0) | 2021.06.10 |
[MongoDB] Model Relationships Between Documents (2) (0) | 2021.06.10 |
[React] Fetch data in React (2)💦 (0) | 2021.05.27 |
[React] Fetch data in React (1) (0) | 2021.05.27 |
댓글 영역