admin管理员组

文章数量:1336633

I'm new to Hasura. I just setup Hasura and connect it with MongoDB. I follow the instruction according to the guide here: / The database is connected, and the queries are working(execept the mutation). However, there's a problem with Hasura GraphQL interface as image below:

in the "Add New" there's no mutation option. Also when I write a simple mutation by myself, the error shows "no mutations exist" as image below:

I'm thinking if it is due to the write permission in MongoDB is set to false. But how can I set it up? Need some help. Thanks

I'm new to Hasura. I just setup Hasura and connect it with MongoDB. I follow the instruction according to the guide here: https://www.mongodb/developer/products/atlas/graphql-apis-hasura/ The database is connected, and the queries are working(execept the mutation). However, there's a problem with Hasura GraphQL interface as image below:

in the "Add New" there's no mutation option. Also when I write a simple mutation by myself, the error shows "no mutations exist" as image below:

I'm thinking if it is due to the write permission in MongoDB is set to false. But how can I set it up? Need some help. Thanks

Share Improve this question asked Nov 20, 2024 at 0:47 Link LinLink Lin 211 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Its a bit late, for for anyone else I struggled with the same thing as most documentation are for Hasura v2.

If you are using the new DDN v3 hasura with mongo, I found that mutations are not auto-created. Refer to this: https://hasura.io/docs/3.0/graphql-api/mutations/

mutations are used to modify data by invoking commands in your Hasura DDN project

You create commands as you would for mongo, for example calling an update command on the 'artist' collection with variables styled for hasura:

"command": {
"update": "artist",
"updates": [{ 
  "q": {"_id": "{{id}}"}, 
  "u": {
    "name": "{{name}}"
  }
}]
}

Then apply them to your schema like so: https://hasura.io/docs/3.0/data-modeling/command/

本文标签: mongodbHasura GraphQL doesn39t have mutation optionStack Overflow