【问题标题】:Update sails model without trigger lifecycle?在没有触发生命周期的情况下更新帆模型?
【发布时间】:2015-05-02 14:34:37
【问题描述】:

我知道不支持model.save({ silent: true }, callback);。但是有人知道如何在不触发生命周期事件的情况下更新 Sails 模型吗?

我已经问过github问题,但到目前为止仍然没有回应。链接是here

【问题讨论】:

    标签: sails.js waterline


    【解决方案1】:

    您可以通过使用 .native()/.query() 来执行查询,从而避免回调。

    如果您使用 MongoDB,请使用 .native(),如果您正在运行 MySQL/Postgres,请使用 .query()

    http://sailsjs.org/#!/documentation/reference/waterline/models/native.html

    http://sailsjs.org/#!/documentation/reference/waterline/models/query.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-23
      • 1970-01-01
      相关资源
      最近更新 更多