1

I am a newbie at sails-orientdb. I want to implement transaction via sails-orientdb. But currently, I don't know how to rollback my query when it's get some errors.

I've read this article before, Transaction in orientdb and waterline. But it's not help for my case.

Thanks,

Community
  • 1
  • 1
Tam Pham
  • 41
  • 3
  • Can you add some code? – jezrael Jul 22 '15 at 06:37
  • var db = app.models.user.getDB(); var tx = db.begin(); tx.create(req.body); return tx.commit().then(function (results) { res.json(results.created); }); – Tam Pham Jul 22 '15 at 09:55
  • Sorry for my code is too ugly. I want to know my query is error or not, if it got error I want to rollback all thing I have done. But the function .rollback() is undefined. – Tam Pham Jul 22 '15 at 09:58
  • @jezrael, here is my expected, http://stackoverflow.com/questions/29586175/waterline-transaction-through-sails-orientdb, but .rollback() function is not defined. – Tam Pham Jul 22 '15 at 10:04
  • Tam Pham, sails-orientb (and waterline) does not support transactions, hence it does not support `.rollback`. OrientDB transactions are supported via Oriento (which you can access via `.getDB()`) so you need to find out how to do a rollback in Oriento. – Dário Jul 22 '15 at 10:06

0 Answers0