【问题标题】:unrecognized modifier `_bsontype` in sails v1Sails v1 中无法识别的修饰符“_bsontype”
【发布时间】:2019-08-23 17:52:27
【问题描述】:

我正在尝试将我的sails.js 应用程序从 v0.12 升级到 v1。以下查询在升级后不再起作用。

return Passport.findOne({
    protocol: 'local',
    user: user.id // also tested user instead of user.id
  })

我收到以下错误:

{ UsageError: Invalid criteria.
   Details:
     Could not use the provided `where` clause.  Could not filter by `user`: Unrecognized modifier (`_bsontype`) within provided constraint for `user`.
}

提前感谢您对此提供的任何帮助。

【问题讨论】:

  • 你找到答案了吗?
  • @ShashanSooriyahetti nope,由于问题跳过了迁移。这对我们来说是不值得的。

标签: node.js sails.js waterline


【解决方案1】:

似乎 findOne 不喜欢 _bsontype 属性,而应该是纯字符串

这行不通

// Fetch the user associated with the Passport
return User.findOne({ id: passport.user });

但这会很好用

// Fetch the user associated with the Passport
return User.findOne({ id: passport.user + '' });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-24
    • 2018-01-19
    • 2014-04-02
    • 1970-01-01
    • 2016-07-23
    • 2021-10-22
    • 2020-09-30
    相关资源
    最近更新 更多