MichalLytek / type-graphql

Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
https://typegraphql.com
MIT License
7.99k stars 674 forks source link

Add helpful comment about unique id in subscriptions resolver #1566

Closed MrEmanuel closed 8 months ago

MrEmanuel commented 8 months ago

The id is needed as a unique identifier for the Apollo Client cache. However, if the mongodb database har multiple instances, the naive approach in the documentation will be an issue since the id is only stored in-memory in each mongodb instance. Thus, there will be duplicates.

Adding a comment about what the id is for gives the developer a chance to make an informed decision.

MrEmanuel commented 8 months ago

Never mind. The id seem to be necessary.