Skip to content

GraphQL return different number of records when adding fields that is relationship to another entity #111

Closed
@chanhengseang3

Description

@chanhengseang3

I have this problem: i query a type with field that is basic type, it return correct result. but if i add another field with another type that has relationship to each other then the result may be incorrect.

Here's the use case:

  Clients{
    select{
      firstname
    }
  }
}

returning:

  "data": {
    "Clients": {
      "select": [
        {
          "firstname": "Smith"
        },
        {
          "firstname": "Johnson"
        }
      ]
    }
  }
}

and then

  Clients{
    select{
      firstname
      image{
        id
      }
    }
  }
}

returning

  "data": {
    "Clients": {
      "select": [
        {
          "firstname": "Smith",
          "image": {
            "id": 1
          }
        }
      ]
    }
  }
}

i am expecting:

  "data": {
    "Clients": {
      "select": [
        {
          "firstname": "Smith",
          "image": {
            "id": 1
          },
          {
          "firstname": "Johnson",
          "image": {
            "id": null
          }
        }
      ]
    }
  }
}

I'm not sure my expectation is correct. Please give the argument.

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