Closed thekid closed 2 years ago
ACID Transactions in MongoDB
use com\mongodb\MongoConnection; $c= new MongoConnection('mongodb+srv://server.example.com'); $transaction= $c->session()->transaction(); $collection->update($id1, ['$inc' => ['qty' => -1]], $transaction); $collection->update($id2, ['$inc' => ['qty' => 1]], $transaction); $transaction->commit(); // or $transaction->abort();
See https://www.mongodb.com/transactions
Initial support in https://github.com/xp-forge/mongodb/releases/tag/v0.10.0
ACID Transactions in MongoDB
See https://www.mongodb.com/transactions