【问题标题】:Nested property where clause with Sails.js 1.0 not working anymoreSails.js 1.0 的嵌套属性 where 子句不再起作用
【发布时间】:2023-03-23 04:01:02
【问题描述】:

我刚刚升级到 Sails.js 1.0,我的装饰器模式停止工作。

这就是我所拥有的:

let model = Model.find()

model
  .where({
    'nested.property': {
      '>': 1
    }
  })

model.exec()

给我:

无法使用提供的where 子句。无法过滤 nested.property: nested.property 不是一个有效的名称 水线中的属性。即使这个模型 (model) 声明 schema: false,这是不允许的。

我的数据库是 MongoDB。

【问题讨论】:

    标签: javascript mongodb sails.js waterline


    【解决方案1】:

    这是一个不再有效的未记录功能。这里是完整的报价:

    您似乎依赖于一些未记录的功能 恰好在以前的版本中工作的水线;即 在 Waterline 查询中使用本机 Mongo 查询语法。在 1.0 中, 您需要使用较低级别的数据存储功能。

    Source

    我最终使用了支持点表示法的mquery(例如nested.property)。

    【讨论】:

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