我正在尝试将我的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`.
}
先谢谢你的帮助。
似乎 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 + '' });