sails-orientdb

SELECT and UPDATE multiple records in oriento / orientjs and transaction in waterline

做~自己de王妃 提交于 2019-12-22 01:49:25
问题 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

Transaction in orientdb and waterline

无人久伴 提交于 2019-12-12 01:48:54
问题 I am trying to to create transaction in waterline but I am getting this error from OrientDB: com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.BEGIN Here is my code: try { itemsModel.query("BEGIN", function(err) { if (err) {throw new Error(err);} itemsModel.update({id:items_ids,status:ACTIVE},{status:INACTIVE}) .exec(function(err, INA_items){ if (err) {throw new Error(err);} if (INA_items.length != items

Waterline Transaction through sails-orientdb

帅比萌擦擦* 提交于 2019-12-11 10:57:31
问题 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(); }); 来源: https://stackoverflow.com/questions/29586175/waterline-transaction-through-sails-orientdb

Select specific fields from database

岁酱吖の 提交于 2019-12-08 15:16:51
问题 I just want to know that is it possible to select specific fields using waterline, orientdb query is given below. e.g. select phone from user I want to select phone from user vertices by using this query userModel.find(phone) .then(function(phonelist){ if(!phonelist) console.log('msg: RECORD_NOT_FOUND'); else console.log(phonelist); .catch(function(err){ console.log('err: 'err'); }); 回答1: Yes, it's possible, you just need to add select to your search criteria, for example (assuming you are

SELECT and UPDATE multiple records in oriento / orientjs and transaction in waterline

六月ゝ 毕业季﹏ 提交于 2019-12-04 22:11:42
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. Try this db.update(id).set({status:INACTIVE}).scalar() Have you tried following? db