Oihana PHP Arango

keep.php

Table of Contents

Functions

keep()  : string
Keep only the given top-level attributes of a document.

Functions

keep()

Keep only the given top-level attributes of a document.

keep(string $document, string ...$attributes) : string

Wraps the ArangoDB AQL function KEEP(document, attributeName1, … attributeNameN). The attribute names are emitted as quoted string literals (json_encode), so AQL receives a valid call; the document stays a raw expression.

Example AQL usage:

KEEP(doc, "name", "age")   // a copy of doc with only its name and age attributes
Parameters
$document : string

The document variable or expression.

$attributes : string

The attribute names to keep.

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

$expr = keep('doc', 'name', 'age');
// Produces: 'KEEP(doc,"name","age")'
see
https://docs.arangodb.com/stable/aql/functions/document-object/#keep
keepRecursive()
since
1.1.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results