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

Use union types for indexed filter inputs with operators #386

Open
murillo128 opened this issue Oct 1, 2021 · 0 comments
Open

Use union types for indexed filter inputs with operators #386

murillo128 opened this issue Oct 1, 2021 · 0 comments

Comments

@murillo128
Copy link

murillo128 commented Oct 1, 2021

I have struggled for a couple of days in how to make the operators to work with input fields as the syntax is a bit awkward compared to the typical mongodb filters.

I was thinking if it could be possible to use instead of the scalar input type and the operator type an union of both types. That way instead of doing:

find(filter:{value:1})
find(filter:{_operators:{value:{gt:1}})

we could allow both type of queries:

find(filter:{value:1})
find(filter:{value:{gt:1}})

I am willing to work on a PR for this, but I would need some feedback/pointers/help.

Up to now, I have been able to create a UnionTypeComposer from both types, but I don't know how replace the original input filter type with the union one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant