Waterline version:0.21.1
Node version:5.0.0
NPM version: 3.5.2
Operating system: Windows 10
I need something like this
User.findOneByEmail(email)
.populate('patients', {
where: {
disabled: [false,null]
}
})
but the populate cames empty in that case but if I do in this way:
User.findOneByEmail(email)
.populate('patients', {
where: {
disabled: null
}
})
works fine
Hi @fatalhck! It looks like you may have removed some required elements from the initial comment template, without which I can't verify that this post meets our contribution guidelines. To re-open this issue, please copy the template from here, paste it at the beginning of your initial comment, and follow the instructions in the text. Then post a new comment (e.g. "ok, fixed!") so that I know to go back and check.
Sorry to be a hassle, but following these instructions ensures that we can help you in the best way possible and keep the Sails project running smoothly.
_If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]._
ok, fixed!
Thanks @fatalhck I'll take a look. Also please don't pollute the comments with +1's.
Thanks
Ah @fatalhck I see the issue. IN queries get expanded to the following in SQL:
disabled=false or disabled=null
The disabled=null value is invalid SQL. In this case you want to use an OR query which should return the correct values.
User.findOne({ email: email })
.populate('patients', {
or: [
{ disabled: false },
{ disabled: null }
]
})
.exec(/* ... */);
Most helpful comment
Hi @fatalhck! It looks like you may have removed some required elements from the initial comment template, without which I can't verify that this post meets our contribution guidelines. To re-open this issue, please copy the template from here, paste it at the beginning of your initial comment, and follow the instructions in the text. Then post a new comment (e.g. "ok, fixed!") so that I know to go back and check.
Sorry to be a hassle, but following these instructions ensures that we can help you in the best way possible and keep the Sails project running smoothly.
_If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]._