Oihana PHP Arango

mergeRecursive.php

Table of Contents

Functions

mergeRecursive()  : string
Recursively merge multiple documents into a single document.

Functions

mergeRecursive()

Recursively merge multiple documents into a single document.

mergeRecursive(string|array<string|int, mixed>|null $documents) : string

Wraps the ArangoDB AQL function MERGE_RECURSIVE(document1, … documentN). Unlike merge(), sub-documents with the same key are merged recursively rather than replaced wholesale.

Example AQL usage:

MERGE_RECURSIVE({a: {b: 1}}, {a: {c: 2}})   // returns {a: {b: 1, c: 2}}
Parameters
$documents : string|array<string|int, mixed>|null

Multiple documents to merge (at least 2 required).

Tags
example
use function oihana\arango\db\functions\documents\mergeRecursive;

$expr = mergeRecursive(['doc1', 'doc2']);
// Produces: 'MERGE_RECURSIVE(doc1,doc2)'
see
https://docs.arangodb.com/stable/aql/functions/document-object/#merge_recursive
merge()
since
1.1.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results