graphql-compose / graphql-compose/graphql-compose-mongoose
Documentation for filter operators is unclear
- Dominant language
- TypeScript
- Stars
- 706
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
I've been trying to write a query to give me all the documents created in the last week but I couldn't figure out how the operator syntax works. The documentation in the README has almost no high-level explanation of how the syntax works out-of-the-box. There's some stuff in there about building support for custom relations, and some other fairly deep stuff, but nothing that shows you can simply do this:
```
{
userMany(filter:{ _operators:{ dateCreated:{ gte: "2020-04-01" }}}){
firstName,
lastName
}
}
```
It took me over an hour to figure that out. And actually, the biggest problem I had was that my `dateCreated` field didn't have `index: true` on the schema. Luckily I found a comment in a random spot in the documentation that led me to understand that operators only work for indexed fields, but the error message I got was unclear.
There's also nothing that shows how to use the `in[]` or `nin[]` syntax.
Anyway, I think my point here is that this syntax is incredibly powerful but basically undocumented. Some of the information exists in the README but it takes a lot of digging and trial and error to figure it out. Maybe the filtering syntax is part of the parent `graphql-compose` project and shouldn't be a part of this one? But if it's unique to this package I think it should have a little more prominence in the documentation.
I'd write it myself and submit a PR but I know I don't understand how it all works, aside from this bit that I figured out on my own.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.