keystone: Underscore in field name causes GraphQL error: Unable to find Mongo field which maps to graphQL path error
Bug report
Describe the bug
I’m migrating from Keystone 4 to Keystone 5. I have a database that has fields which have underscores in them (news_site, news_site_long). When I define these fields in createList
I get the following error:
GraphQL error: Unable to find Mongo field which maps to graphQL path news
I’ve been searching in the docs to prevent this behavior, but I couldn’t find an option.
To Reproduce
Steps to reproduce the behaviour. Please provide code snippets or a repository:
- Define a field with an underscore in it
- In the admin GUI, Click on the list
- See error
Expected behaviour
I expect to see a list of all my entries in that MongoDB collection.
Screenshots
System information
- OS: Debian, MacOS
- Browser (if applies): Opera, Chrome
Additional context
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 20 (5 by maintainers)
By accident, I found a possible solution/workaround: Define a non-underscore item as first item in the list (title, name, etc.). All underscore items will now behave correctly.
That worked partially for me, as
defaultSort:
breaks it again.Unfortunately, with
defaultSort:
it breaks again when you try to sort on an item with an underscore.