Mutation partially following the current schema

I have a generic type of schema in my database, such as:

type Event{
    activity: String! @search(by: [term])
    timestamp: String!

Events can be really generic, each one having its own attributes.

What I want to do

I want to be able to add data without the need to specify all attributes of different events on my schema.

What I did

I tried to include events normally with GraphQL mutations, but I got raised the error unknown field.

Dgraph metadata

dgraph version

Dgraph version : v21.03.1

You are using GraphQL, so that’s how GraphQL works. It is a highly typed API. Everything must be explicitly set. You should move to DQL instead.

DQL is indifferent to your attributes, but it eventually will be added to your schema automatically.

1 Like

The more I work with dgraph, the more I see the power of DQL.

1 Like