Hi, I’m using and Apollo federated graph with node and mongod. I have two services, each with their own database, and I’m trying to use a type from another service to resolve some embedded data. I know I can use __resolveReference
in my service, but I have all the data embedded - I don’t need to look the item up - I just need to use the type and its field resolvers from my other service.
This is just an example of my problem, so if I have a “Box” collection in one database and an “Item” collection in the other, and when creating a “Box” I embed the “Item” data like this:
{
"_id": "1234",
"name": "Box",
"contents": {
"addedAt": "",
"item": {
"name": "item",
"description": "desc"
....
}
}
}
And my types like this:
// Box service
type Box {
id: ID!
name: String!
items: [BoxItem]
}
type BoxItem {
addedAt: DateTime!
Item: Item!
}
// Item service
type Item {
id: ID!
name: String!
description: String
createdAt: DateTime!
expiresAt: DateTime!
expiresInDays: String //<--- item field resolver that returns a human readable string of how many days to expiry date
}
What would be the best way for my federated graph to resolve the Item type that is embedded in my BoxItem type so I get all the typed fields and field resolvers?