-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Transactions
-
None
Suppose I have:
- Customer has_and_belongs_to_many reservations
- Reservation has_and_belongs_to_many customers
If I add a relation such as Customer.reservations << res, both the Customers and Reservations collections in my database will be updated. The updates to both collections should be wrapped in a single transaction, to ensure integrity of both collections.
This ticket would only apply if I am using a server version which supports multi-collection transactions. I forget exactly but I think this was introduced in 4.2 for non-shards and 4.4 for shards.
Transactions should not be used in the case of inverse_of: nil is used, because the relationship then becomes one-sided.
- is related to
-
MONGOID-5548 Add implicit transactions to Mongoid
- Backlog