1

I'm using transaction in the following code, can I enhance this code furthermore?

var db = itemsModel.getDB();
var trans = db.begin();
trans.update('items')
     .set({status:UNAVAILABLE})
     .where({id:items_ids_list,status:AVAILABLE}).exec()
     .then(function(items){ 
         if (items.length != items_ids_list.length) {
             trans.rollback(); /* send error here*/
         } else trans.commit();
     });
Travis Webb
  • 14,688
  • 7
  • 55
  • 109
Zeeshan
  • 375
  • 1
  • 3
  • 17
  • what do you mean by "enhance"? What is your goal? – Travis Webb Apr 15 '15 at 01:49
  • 1
    This seems related to [SO: SELECT and UPDATE multiple records in oriento](http://stackoverflow.com/questions/29446477/select-and-update-multiple-records-in-oriento) and there has been some dialog about it in [gitter on April 8 2015](https://gitter.im/codemix/oriento?at=55251e1938224c543c15ed75). – Dário Apr 17 '15 at 15:57

0 Answers0