Skip to content

arrayConcat - Join two arrays together

The arrayConcat function will join the elements of two arrays together, to produce one array with elements of both.

Syntax

arrayConcat(array1: array<T>, array2: array<T>): array<T>

Arguments

NameTypeRequiredDescription
array1array of type TtrueT must be either string, bool, number, interval, timestamp, regexp or enum
array2array of type TtrueT must be either string, bool, number, interval, timestamp, regexp or enum

Example - Creating a global view of waiting jobs

Consider the following document:

{
    "processing_jobs_waiting": ["job1", "job2", "job3"],
    "loading_jobs_waiting": ["loading_job1", "loading_job2", "loading_job3"]
}

If we want to see all processing and loading jobs in one place, we can use arrayConcat:

create all_jobs from processing_jobs_waiting.arrayConcat(loading_jobs_waiting)

This will result in the following document:

{
    "processing_jobs_waiting": ["job1", "job2", "job3"],
    "loading_jobs_waiting": ["loading_job1", "loading_job2", "loading_job3"],
    "all_jobs": ["job1", "job2", "job3", "loading_job1", "loading_job2", "loading_job3"]
}