https://edykim.com/ko/post/summary-of-six-rules-for-designing-a-mongodb-schema/
https://seungdols.tistory.com/775
인덱스 관련 : https://blog.ull.im/engineering/2019/04/05/mongodb-indexing-strategy.html
모델링 : https://docs.mongodb.com/manual/core/data-modeling-introduction/#data-modeling-introduction
트랜잭션 : https://docs.mongodb.com/manual/core/transactions/
In MongoDB, a write operation is atomic on the level of a single document, even if the operation modifies multiple embedded documents within a single document. When a single write operation modifies multiple documents (e.g. db.collection.updateMany()
), the modification of each document is atomic, but the operation as a whole is not atomic.
(대충 해석 하면, 여러 documents 쓰기 하면 원자성 보장 못한다. 한개 한개의 document내에서만 원자성이 보장된다.)
위의 이유때문에, 임베디드 형태의 data 모델링을 추천한다.
만약, 여러 document 혹은 collection 를 업데이트 하는데 원자성을 유지하고 싶다면, 버전 4.0 부터는 트랜잭션을 지원하는데 성능이 훨씬 안좋다.
before
{ _id: "joe", name: "Joe Bookreader" }