FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

For more details, review the migration guide. Contact support@fauna.com with any questions.

Append

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Append( elems, base )
append( elems, base )
Append( elems, base )
Append( elems, base )
Append( elems, base )

Description

The Append function creates a new array that is the result of combining the base Array followed by the elems. This is a specialized function, and only works with arrays and not pages.

Parameters

Parameter Type Definition and Requirements

elems

Value or Array of Values

The elements to add to the end of the base array.

base

Array

The base array.

Returns

A new Array containing both the base array followed by the elems.

Examples

The following example creates a new array containing the base array’s values, (1, 2, 3), followed by the elems array’s values, (4, 5, 6).

client.query(
  q.Append([4, 5, 6], [1, 2, 3])
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
[ 1, 2, 3, 4, 5, 6 ]
result = client.query(
    q.append([4, 5, 6], [1, 2, 3])
)
print(result)
[1, 2, 3, 4, 5, 6]
result, err := client.Query(
	f.Append(f.Arr{4, 5, 6}, f.Arr{1, 2, 3}))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
[1 2 3 4 5 6]
try
{
    Value result = await client.Query(
        Append(Arr(4, 5, 6), Arr(1, 2, 3))
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
Arr(LongV(1), LongV(2), LongV(3), LongV(4), LongV(5), LongV(6))
Append([4, 5, 6], [1, 2, 3])
[ 1, 2, 3, 4, 5, 6 ]
Query metrics:
  •    bytesIn:  39

  •   bytesOut:  26

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 2ms

  •    retries:   0

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!