MongoDB multi-document ACID transactions کو support کرتا ہے (v4.0 سے replica sets کے لیے، v4.2 سے sharded clusters کے لیے) — متعدد documents/collections میں operations کو group کرتے ہوئے تاکہ وہ تمام کامیاب ہوں یا تمام ناکام ہوں۔ لیکن MongoDB کا document model اکثر transactions کو غیر ضروری بناتا ہے atomic single-document operations کے ذریعے۔
Single-document operations پہلے سے ہی atomic ہیں
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.
