underscore-query
underscore-query copied to clipboard
Is there a $toBool capability?
I have a lot of queries that need to filter based on the truthiness of many state properties. What would be the best way to handle those conditions with underscore-query?
The best I've come up with is the following...
For a condition where any of the answers is truthy...
$or: [ "formAnswers.answerOne": {$nin: [0, null, false, ""]}, "formAnswers.answerTwo": {$nin: [0, null, false, ""]}, "formAnswers.answerThree": {$nin: [0, null, false, ""]}, ]
It seems like there should be a simpler way to do this.