Fauna relies on your feedback to educate our product development process. To help us prioritize this feature in our product roadmap, please vote for this topic and complete our 2020 GraphQL Roadmap Survey.
At the time being, it is not possible to define a type in the schema without a Collection being created for it automatically during import. There are several cases in which the types do not need a Collection backing them up. The most recurrent is when trying to implement the payload pattern.
- We could provide a new directive to prevent a Collection being created for a given type (e.g., @value, @value_object).
- Alternatively, we could go the other way around and only auto-generate a collection if the type has been annotated with a specific directive. This is how Prisma and AWS Amplify work; they have a specific @model directive in order to do so. At Fauna, we were thinking an @entity directive might make more sense (it’s more aligned to the DDD lingo, since everything in the schema is actually part of the “model”). We could also leverage our already built-in @collection directive.
For now, you can try annotating with the @embedded directive to prevent a collection from being created. Bear in mind this might not work in all scenarios since this is not the intention for which the @embedded directive is designed.**
If you have implemented your own solution/s that you think could help other users, please share them as replies to this topic and/or make a gist and link to it from the awesome-faunadb list.