Skip to content

Error: `Fields "book" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional. #2390

Closed

Description

@bappajubcse05

I am trying to fetch all the records from a table/entity book and the books created by me using a graphQL query:

{  
  book(filter: "user ==Thomas") {
    edges {
      node {
        name        
      }
    }
  }
  book {
    edges{
      node{
        name
      }
    }
  }
}

But it is throwing below error:

Fields "book" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.

I am not sure how I can retrieve these details using a single query. If I need to use alias, how can I define the aliases in the query?

Activity

  1. aklish commented on Oct 29, 2021

    @aklish
    Member

    Rewrite your query more like:

    {  
      mybooks1: book(filter: "user ==Thomas") {
        edges {
          node {
            name        
          }
        }
      }
      mybooks2: book {
        edges{
          node{
            name
          }
        }
      }
    }
    

    where mybooks1 and mybooks 2 are aliases you assign to each collection.

  2. locked and limited conversation to collaborators on Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions