Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink Boolean Filter Type #159

Open
pozylon opened this issue May 8, 2020 · 1 comment
Open

Rethink Boolean Filter Type #159

pozylon opened this issue May 8, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pozylon
Copy link
Member

pozylon commented May 8, 2020

Do you have any suggestions on how to proceed @macrozone ?

@pozylon pozylon added the enhancement New feature or request label May 8, 2020
@macrozone
Copy link
Contributor

@pozylon hmm lets go through all possibilities.

I think you have decide between some conventions:

a) Products have "trilian" attribute, its either true, false or null in the database. (its basically an optional boolean)
b) Products have "boolean" attribut, its always either true or false
c) Products have "boolean" attribute, but we encode it as either true or not existing (null). This is the same as b semantically.

now clients can use the attribute in three different ways

1.) give me everything where attribute = true. would return only products with true in all cases

2.) give me everything where attribute = false. I think this should also return products where the value is false in all cases (or null or not existing in case c)

3.) give me everything no matter the attribute. The attribute does not exist in the filter query:
this should return all products in all cases

4.) give me everything where the attribute is null. (so the attribute exists in the filter query and its value is null. Now here it differs. In case a you would probably return only the products where the attribute indeed is null (or does not exist at all). Its not so clear in case b and c and should be documented then. Either this could return only the products where the attribute is false or ignore the attribute.

I think both cases a and b can make sense for certain attributes. I would avoid c as it does not allow to distinguish between a and b. But on the other hand, a can be emulated with a list filter which is maybe more clear... 🤔

Mongodb makes it a bit harder, because you cant easily force the field to always be either true or false, so you tend to treat a non existing field as a false, which boils down to treat b and c identical.

@pozylon pozylon added this to the v3.0 milestone Dec 6, 2022
@pozylon pozylon moved this to v3.0 (Q3 / 2023) in Roadmap Dec 6, 2022
@pozylon pozylon added this to Roadmap Dec 6, 2022
@pozylon pozylon self-assigned this May 8, 2024
@pozylon pozylon modified the milestones: v3.0, v3.1 Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: v3.0 (Q3 / 2024)
Development

No branches or pull requests

2 participants