MongoDB Realm GraphQL - returning multiple types as custom payload in a custom resolver

276 Views Asked by At

I am currently exploring MongoDB Realm, more specifically the GraphQL integration. I have successfully created resolvers which return a specific type, or an array of one type. However, I can't figure out how to return arrays of multiple types...

I have tried to create a custom payload, but I have to define that payload as JSON, and can't reference non-JSON types from in there.

To clarify:

  • I can create a custom resolver which resolves: {shirts: [Shirts]}
  • I cannot create a custom resolver which resolves: {shirts: [Shirts], trousers: [Trousers], shoes: [Shoes]}
  • I cannot create a custom resolver which resolves: {shirts: [Shirts], isFoo: Boolean}

Is there any way to accomplish the latter two? I would be able to do it if I was allowed to edit the GraphQL schema directly, but as far as I can see, one is only able to modify the schema through this custom resolver interface...

Thanks in advance!

0

There are 0 best solutions below