Aligning one-to-many relationships between graphql schemas

Imagine we’ve got a one-to-many relationship:

type Project {
  tasks: [Task!]

type Task {
  dueDate: String!

When querying this relationship, the Fauna GQL docs show one must use data to access the relations’ data. For example:

query FindProject {
  getProjectByID(id: 804140812042) {
    tasks {
      data {

In server-side JS the response might provide the tasks data like so:

const tasks =;

Is there a recommendation for how to align this data structure, with the data property inserted, when using a similar Schema on the frontend (e.g. a React app calling an Apollo server)? An error like Expected Iterable, but did not find one for field "Project.tasks". is seen if one does not parse data returned by Fauna before it’s sent to the GraphQL server and onwards to the frontend.

Options I can think of include:

  • Somehow adding a data field to relevant object types in the frontend schema
  • Parsing responses from the Fauna GraphQL API to unnest/remove the data property before sending data to the frontend (seems dodgy!)
  • Just accepting there may be extra data properties throughout the code


I’m not entirely sure whether I understand the question and probably need more insights in what is blocking you. Are you using Apollo server in front of Fauna with a remote schema? I something blocking you from using the regular Fauna schema with Apollo. Or do you just want to get rid of the ‘data’ fields for convenience?

As far as I can see, you could unnest the data property from a convenience perspective but will need to make sure there are no conflicts.

Hi Brecht. The reason for my question is to “get rid of the ‘data’ fields for convenience” so the data returned by a GraphQL request to Fauna matches the Apollo Server schema, which doesn’t define data fields. As you note, this could be done manually so my question is whether there is a best practice for this scenario. From your response, I’m guessing there is not.

I’m responding here in case this info is useful to someone else but, frankly, I migrated my personal projects away from Fauna (for context, to Google Cloud SQL with ORMs/Prisma intermediary), so there is not an onus on you to respond and I’m not blocked by this. Thank you anyway.