Array remove value

The array_remove_value mutation removes the given value of an array.

Examples

We will be making some changes to the following company document:

{
  "_meta": {
    "index": "companies",
    "guid": "e6ad61ba9d7e27a12aae81bd7d93d4a347975ff91e8d2c10b00aa7877108deaa",
    "created": 1620227815616,
    "updated": 1620227816609,
    "removed": 0,
    "expiry": 1622819815616,
    "created_by": {
      "host": "myluxura-api",
      "resource": {
        "name": "[email protected]",
        "guid": "785041ee4d640635dad8f0f45c343e912b1c4cb8d4fae18c662f221d4e3dadae",
        "index": "users"
      }
    }
  },
  "name": "Example company",
  "company_type": "owner",
  "location": {
    "place_id": null,
    "description": null
  },
  "tags": ["example", "mistake"]
}

Removing the tag mistake from this company 's tags array should be done as follows:

{
  "action": "array_remove_value",
  "field": "tags",
  "value": "mistake"
}

The body of this update request should look like:

[{
  "action": "array_remove_value",
  "field": "tags",
  "value": "mistake"
}]

Last updated

Was this helpful?