# remove

Learn how to remove values from a collection.

This method chains a `remove` operation to the patch, which removes one or more values from a collection.

If the path does not exist or the target values are not present, the operation succeeds without any effect.

> **Atomicity**
>
> If the value at the specified path is not a list, the operation fails and the entire patch is discarded.

## Signature

This method has the following signature:

```ts
patch.remove(path: string, value: JsonValue): Patch
```

The return is the `Patch` instance itself to allow operation chaining.

## Example

Here is a basic example of how to use this method:

```ts
path.remove('interests', 'data science');
```

The following table shows how the operation behaves in different scenarios:

| Current value          | Given value | Result            |
| ---------------------- | ----------- | ----------------- |
| `['a', 'b', 'c']`      | `'a'`       | `['b', 'c']`      |
| `['a', 'b', 'c', 'c']` | `'c'`       | `['a', 'b']`      |
| `['a', 'b', 'c']`      | `'d'`       | `['a', 'b', 'c']` |
| `['a', {b: 1}, 'c']`   | `{b: 1}`    | `['a', 'c']`      |

## Parameters

The following list describes the supported parameters:

- `path`: `string`

  The path to the collection in dot notation, like `interests`.

- `value`: `JSON`

  The element to remove from the collection, like `data science`.
