如何选择或更新oriento中的多条记录?像在水线我们可以选择和更新oriento中的多条记录和水线中的交易
offersModel.update({id:items_ids,status:INACTIVE},{status:ACTIVE})
但在水线交易不可用。所以我想用:
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();
})
谢谢。
@达里奥没有人回答这个问题。这个问题没有意义吗? – 9me 2015-04-05 19:29:51
嗨@ 9me,也许东方人不会在这里闲逛,你也可以试试[Oriento gitter channel](https://gitter.im/codemix/oriento)和[Oriento project](https:// github的.com/codemix/oriento)。关于你的例子:'.where({id:items_ids,status:ENM.SELLING_STATUS.ACTIVE})。exec()',你不需要'.then(/ * ..)之前的'.exec()'。 * /)'。 – 2015-04-07 13:47:24
@Dário谢谢你的回复。我很抱歉,我无法解释我的用例。我的用例是'begin()然后更新项目,然后**如果有任何项目丢失** rollback()else commit()'我怎样才能执行这个事务? – 9me 2015-04-08 12:12:28