aqlFieldDefault.php
Table of Contents
Functions
- aqlFieldDefault() : string
- Generates a simple AQL key/value expression referencing a document field.
Functions
aqlFieldDefault()
Generates a simple AQL key/value expression referencing a document field.
aqlFieldDefault(string $key, string $doc[, string|null $keyName = null ]) : string
This helper builds a snippet suitable for inclusion in a RETURN { ... } block.
It maps a document property to an object key in the AQL result:
$keybecomes the key in the resulting AQL object.$docand optional$keyNamedefine the field to reference.
If $keyName is omitted, the same name as $key is used.
Example usage:
aqlFieldDefault( 'name' , 'doc' ) ; // "name: doc.name"
aqlFieldDefault( 'userId' , 'doc' , 'id'); // "userId: doc.id"
Parameters
- $key : string
-
The key to use in the resulting AQL object (e.g.
"name"). - $doc : string
-
The document alias or variable name (e.g.
"doc"). - $keyName : string|null = null
-
Optional property name in the document; if omitted,
$keyis used.
Tags
Return values
string —AQL key/value expression string, e.g. "name: doc.name".