How can I select or update multiple records in oriento? Like in waterline we can
offersModel.update({id:items_ids,status:INACTIVE},{status:ACTIVE})
But in waterline transaction is not available. So I want to use :
var db = offersModel.getDB();
var trans = db.begin();
trans.update('offers')
.set({status:INACTIVE})
.where({id:items_ids,status:ENM.SELLING_STATUS.ACTIVE})//.exec()
.then(function(offers){
if (offers.length != items_ids.length) {trans.rollback(); /* send error here*/}
else trans.commit();
})
Thanks.
.where({id:items_ids,status:ENM.SELLING_STATUS.ACTIVE}).exec()
, you don't need an.exec()
before a.then(/*...*/)
. – Fenrirbegin() then update items then **if any item is missing** rollback() else commit()
How can I perform this transaction ? – Shelvescalar()
function like in this example – Hyades