sails v1中未识别的修饰符`_bsontype`。

问题描述 投票:2回答:1

我正在尝试将我的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`.
}

先谢谢你的帮助。

node.js sails.js waterline
1个回答
0
投票

似乎 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 + '' });
© www.soinside.com 2019 - 2024. All rights reserved.