【问题标题】:Checking if the datetime in the column is not more than 1 hour old检查列中的日期时间是否不超过 1 小时
【发布时间】:2017-01-19 14:22:49
【问题描述】:

如何检查特定列 modified 是否不超过 1 小时?

MessageModel.findAll({
        where : {
            status : Constant.PROCESSING,
            modified : {
                // ?? //
            }
        }
    });

如何使用 sequelize 编写条件?

【问题讨论】:

    标签: node.js orm sequelize.js


    【解决方案1】:

    您可以像这样使用大于或等于语法 ($gte):

    modified : { $lte: new Date(Date.now() - 60*60*1000) }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-23
      • 2012-03-02
      • 2011-02-19
      • 2011-01-24
      • 2021-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多