Autogenerate bulk mutations (createAll, updateAll, deleteAll)

Fauna relies on your feedback to educate our product development process. To help us prioritize this feature in our product roadmap, please vote for this topic and complete our 2020 GraphQL Roadmap Survey.

Proposal

This would likely follow the autogenerated API defined by the OpenCRUD spec. See OpenCRUD: Mutations: Batch Operations

Workaround

Run a mutation with multiple root fields.

Example

1. Import schema:

type Post {
  title: String!
  content: String!
}

2. Run mutation:

mutation CreateAll {
  a: createPost(data: {
    title: "Post A"
    content: "Some content"
  }) {
    _id
  },
  b: createPost(data: {
    title: "Post B"
    content: "Some content"
  }) {
    _id
  }
}

Note: the two Posts will be created in a single transaction.


If you have implemented your own solution/s that you think could help other users with this, please share them as replies to this topic and/or make a gist and link to it from the awesome-faunadb list.

That’s what I’ve done a lot in GraphQL playground.
I wish I could do it dynamically on my app. Not sure how. Maybe mutating the string before sending it.
It would be great to have bulk updates from graphql.