Returning full complement of data from mutation


Hi all, hope someone can help me.

Firstly when using the info object in my mutations am I right it only returns the information defined in the schema for that Mutation. For example if I have defined a mutation createEvent:

createEvent(title: String!, description: String, startDate: DateTime!, locations: [Locations]): Event!

Am I right in saying once I run the actual mutation:

 async createEvent(parent, args, ctx, info) {
    const { title, description, locations, startDate } = args;
    const { userId } = ctx.request;

    const newEvent = await ctx.db.mutation.createEvent(
        data: {
          locations: { create: [...locations] },
          leader: {
            connect: {
              id: userId,
    return newEvent;

Then newEvent will only contain the id, description startDate and Locations array?

I want to return everything defined in my Event datamodel as I will be using it in a subscription:

type Event {
id: ID! @unique @id
leader: User! @relation(name: “UserEvents”)
title: String!
description: String
startDate: DateTime!
attendees: [User] @relation(name: “AttendingEvents”)
locations: [Location] @relation(name: “EventLocations”)
comments: [Comment]
updatedAt: DateTime! @updatedAt
createdAt: DateTime! @createdAt

What is the best practice for doing this?




This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.