Skip to content

arrayRemoveAt - Removes element from array at given position

arrayRemoveAt will return an array with the element at the given position removed.

Syntax

arrayRemoveAt(array: array<T>, position: number): array<T>

Arguments

Name Type Required Description
array array of type T true T must be either string, bool, number, interval, timestamp, regexp or enum
position number true The position at which to remove the element from the array. This value is 0 indexed

Example - Removing a job from the middle of a queue

Consider the following document:

{
    "values": ["Job 1", "Job 2", "Job 3", "Job 4"]
}

Removing an item from a given point in an array is as simple as:

replace values with values.arrayRemoveAt(2)

This results in the following document:

{
    "values": ["Job 1", "Job 2", "Job 4"]
}

Try it yourself

Open up your explore screen and enter the following command:

create values from ['Job 1', 'Job 2', 'Job 3', 'Job 4']
| create updated_values from values.arrayRemoveAt(2)