How to get the model name from the query

query($courseUUID: String) {
    course(filter: { uuid: { eq: $courseUUID } }) {
      course_uuid: uuid,
      title,
      desc: description
      type -> I want to get the type of the model 
    }
}

How to get the type of the model from the query? Instead of having a type, single line string, field in the model, and write the model name in every record, I want to get it when querying the model.

type = course won’t work.

@henok.tesfaye have you tried using __typename ? Would that be good enough?

@mat_jack1 thanks, __typename adds Record after the model name. Like if the model is chapter, it will be ChapterRecord.

_modelApiKey worked.

1 Like

Great! :slight_smile: