Reputation: 1158
I'm having an issue where my model is defined with an attribute of type boolean
but at some point it's being interpreted as a string.
For example, with a model that looks like this:
{
attributes: {
id: 'string'
boolean_thing: {type: 'boolean', columnName: 'BooleanThing'},
}
}
when given a request like this:
/api/foo?boolean_thing=false
will result in the where
criteria being passed to the adapter looks like this:
{
where: {
BooleanThing: 'false'
},
limit: 30,
skip: 0
}
I'm currently running [email protected]. Does anyone know if this is a bug or a misconfiguration issue on my part?
Upvotes: 1
Views: 83
Reputation: 3697
Maybe this problem: https://github.com/balderdashy/sails/issues/1818?
You can do this as a fix:
var bol = (req.params("boolean_thing") == "true");
mymodel.find().where({BooleanThing: bol}).exec(...
Upvotes: 1