e-oj / Fawn

Transactions for MongoDB (See the README)
https://www.npmjs.com/package/fawn
MIT License
486 stars 54 forks source link

Support for MongoDB 3.4 #67

Closed HenryJsure closed 6 years ago

HenryJsure commented 6 years ago

Hi: I am use Fawn with Mongodb 3.4 and it is not working for rollback , const task = Fawn.Task(); task.update('subject', {name: 'test'}, {phone: '13345550010'}) task.save('subject', subject) try { let res = await task.run(); } catch(err) { console.log('err---', err) } The update still succeeds when the save fails

err log is: ' the update operation document must contain atomic operators.' regds, Henry

HenryJsure commented 6 years ago

I modified roller.js 163 lines add code: data = {$set: data} I wonder if it is reasonable for you to check

e-oj commented 6 years ago

It might be a problem with the MongoDB version. I'm working on adding native transactions to Fawn but you can use transactions directly with MongoDB > 4.0