GraphQL Mutations


        #GraphQL mutation
        mutation {
            createPost(
                title: "My first post",
                content: "..."
            ) {
                _id
                title
            }
        }
    

        #GraphQL result
        {
            "data": {
                "createPost": {
                    "_id": "2xdvdev55s5csf1s3sv3s4v",
                    "title": "My first post"
                }
            }
        }
    

GraphQL respect an error control flow => Mutations executed as a sequence

Otherwise, it's hard to detect errors like adding the same author again and again.

GraphQL Mutations responses


        #GraphQL mutation result
        {
            "data": {
                "createPost": {
                    "_id": "2xdvdev55s5csf1s3sv3s4v",
                    "title": "My first post"
                }
            }
        }
    

        #GraphQL error result
        {
            "errors": [
                {
                    "message": "Must provide an operation"
                }
            ]
        }