aqlFieldNumber.php
Table of Contents
Functions
- aqlFieldNumber() : string
- Generates an AQL key/value expression for a numeric field.
Functions
aqlFieldNumber()
Generates an AQL key/value expression for a numeric field.
aqlFieldNumber(string $key[, string $doc = AQL::DOC ][, string|null $keyName = null ]) : string
This helper constructs an expression suitable for inclusion in a RETURN { ... } block,
converting a document property to a numeric value using TO_NUMBER().
It ensures that non-numeric values are safely handled by AQL.
Behavior:
$keybecomes the key in the resulting AQL object.$docis the document alias or variable.$keyNameoptionally specifies a different property name in the document; defaults to$key.
Example usage:
// PHP call
aqlFieldInt('age');
// Generates: age: TO_NUMBER(doc.age)
aqlFieldInt('id', 'u', 'identifier');
// Generates: id: TO_NUMBER(u.identifier)
Parameters
- $key : string
-
The logical key to use in the AQL return object.
- $doc : string = AQL::DOC
-
The document variable or alias (default:
doc/AQL::DOC). - $keyName : string|null = null
-
Optional property name in the document if different from
$key.
Tags
Return values
string —AQL key/value snippet for numeric conversion (e.g. "age: TO_NUMBER(doc.age)").