Skip to content
Developerhome

In and Not in

  Less than to read

You can filter query results to find objects with one or more specified values using the in keyword.

The _in operator allows you to fetch objects based on if they contain a specific keyword.

The _nin (not in) operator allows you to fetch objects based on if they do not contain a specific keyword.

Both operators support all GraphQL data types.

The following tables displays examples and results of applying filters with _in and _nin operators. Some of the fields displayed are not mandatory and others have been omitted.

{
  xtremMasterData {
    customer {
      query(filter: "{country:{language:{_nin:['French','English']}}}") {
        edges {
          node {
            name
            country {
              name
              language
            }
          }
        }
      }
    }
  }
}

{
  "data": {
    "xtremMasterData": {
      "customer": {
        "query": {
          "edges": [
            {
              "node": {
                "name": "Gaetan Sup Test",
                "country": {
                  "name": "Spain",
                  "language": "Spanish"
                }
              }
            }
          ]
        }
      }
    }
  },
  "extensions": {
    "diagnoses": []
  }
}

{
  xtremMasterData {
    customer {
      query(filter: "{currency:{id:{_in:['EUR','GBP']}}}") {
        edges {
          node {
            name
            currency{
              id
            }
            country {
              name
              language
            }
          }
        }
      }
    }
  }
}
{
  "data": {
    "xtremMasterData": {
      "customer": {
        "query": {
          "edges": [
            {
              "node": {
                "name": "Distributor",
                "currency": {
                  "id": "GBP"
                },
                "country": {
                  "name": "United Kingdom",
                  "language": "English"
                }
              }
            },
            {
              "node": {
                "name": "PITCH SA",
                "currency": {
                  "id": "EUR"
                },
                "country": {
                  "name": "France",
                  "language": "French"
                }
              }
            }
          ]
        }
      }
    }
  }
}