MongoDB unterstützt Multi-Document ACID Transaktionen (seit v4.0 für Replica Sets, v4.2 für Sharded Clusters) — die Gruppierung von Operationen über mehrere Dokumente/Sammlungen hinweg, sodass sie entweder alle erfolgreich sind oder alle fehlschlagen. Allerdings macht Mongodbas Dokumentenmodell Transaktionen durch atomare Single-Document-Operationen oft unnötig.
Single-Document-Operationen sind bereits atomar
KEY POINT: operations on a SINGLE document are ALWAYS atomic in MongoDB.
→ Because related data is often EMBEDDED in one document, many operations that would
need a transaction in SQL are a single atomic document update in MongoDB.
→ Good schema design (embedding) often eliminates the NEED for multi-doc transactions.
