How to define a relation nested in an object in an array? #222
Unanswered
graddaniel
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I've managed to solve it by creating a separate Resolver for the nested entity and a separate Service which inherits from NoOpQueryService (to avoid typical interaction with the DB). The service then implements methods, which explicitly interact with the Model injected to the Service and the Resolver in addition to basic CRUD operations has custom fields, which resolve with the help of the Service. Examples:
Resolver
Service:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TLDR: My query doesn't recognize a field, which has been linked via
@Relation
, to a nested DTO stored in an array, belonging to an outer DTO.Hi,
So far I've been successfully using various relation decorators when dealing various relation types. In worst case, when an incorrect decorator was used, the query would fail to resolve a field. Currently however I am experiencing an issue, where the field is not recognized at all.
I have a MongoDB document, which's one of the fields stores an array of objects and each of those objects references another document.
Then to retrieve these I have defined such DTOs:
Even when I take a look at the generated schema, the Config looks like this (the nestedEntity field is missing):
What's the correct way of defining the relation in such case?
Beta Was this translation helpful? Give feedback.
All reactions