在Sails中更新记录

时间:2018-04-01 10:27:59

标签: node.js sails.js

我想在DB

中更新我的模型记录
update: async function (req, res, next) {

await Place.update({'id':1})
  .set({
    title: req.param('title'),
  })
  .fetch()
  .then(function place_updated(updated_place){
    res.json({'status':true, 'result':updated_place});
    })
  .catch(function(err) {
    if (err) {
      return res.json({'status': false, 'errors': err.Errors});
    }
  });
},  

我确定数据库中有ID 1的记录 但我收到消息Not Found !!!
请帮帮我 谢谢

0 个答案:

没有答案