arrayAppend - Add an element to an array
The arrayAppend
function will add an element to a given array.
Syntax
Arguments
Name | Type | Required | Description |
---|---|---|---|
array | array of type T | true | T must be either string , bool , number , interval , timestamp , regexp or enum |
element | T | true | T must be either string , bool , number , interval , timestamp , regexp or enum |
Example - Adding an extra element to a list for easier processing
If we want to do some array processing, but we're missing some values, the arrayAppend
function is very useful for adding missing elements where they appear in other fields. For example, consider the following document:
We can include my_other_value
in my_values
like so:
This will result in the following document:
Theme
Light