0

I need to be able to create a catalog for a given entity and then somewhere in the grandchildren I want to use the catalog IDs and resolve them.

think of this (very simplified) data model

type Entity {
  id: ID
  componentCatalog: [Component]
  child: Child
}

type Child {
  grandChildren: [GrandChild]
}

type GrandChild {
  components: [Component]
}

in the NoSQL db I would store this as:

{
   id: 'abc',
   componentCatalog: [ { id: 1, title: 'a' }, { id: 2, title: 'b' }],
   child: {
     grandChildren: [
      {
        componentIds: [1]
      },
      {
        componentIds: [1,2]
      }
     ]
   }
}

and I would like to resolve the IDs to the components that are stored in the catalog of the Entity however how do I get to the data from the grandchildren? Parent is just a child, do I have to save the catalog into the GQL context? If so then how? If there are multiple entities in the query how do I know which Grandchild belongs to which entity?

Thanks a lot in advance

kuncajs
  • 1,096
  • 1
  • 9
  • 20

0 Answers0