graphql-compose / graphql-compose/graphql-compose-mongoose

Use union types for indexed filter inputs with operators

Open
#386 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
706
Forks
98
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.