Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am trying to use $cond in Redash to transform a true/false/null to a meaningful value for a report. When I perform the query I only ever get the false case.

This is my query below. I have included the "isSuggestedProgram" in the projection just so I can verify the values for now.

All results show "Custom" as the result regardless of the value of isSuggestedProgram. What is wrong with the way I am doing the $cond?

"collection": "Program", "aggregate": [ "$project": { "isSuggestedProgram": "$isSuggestedProgram", "suggested": { "$cond": { "if": { "$eq": [ "$isSuggestedProgram", "true" "then": "Suggested", "else": "Custom" Becuase you supplied the "string" as "true" rather than boolean true . Since it's actually a boolean already then you can also write as "if": "$isSuggestedProgram" as true/false values will determine the branching. Neil Lunn Jul 4, 2017 at 6:01 I do not mind if it is closed or deleted. But I think that answering is more transparent than commenting. Cheers. Björn Jul 4, 2017 at 6:04

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .