Oihana PHP Arango

aqlFieldBool.php

Table of Contents

Functions

aqlFieldBool()  : string
Generates an AQL key/value expression that converts a document field to boolean.

Functions

aqlFieldBool()

Generates an AQL key/value expression that converts a document field to boolean.

aqlFieldBool(string $key[, string $doc = AQL::DOC ][, string|null $keyName = null ]) : string

This helper builds a snippet suitable for a RETURN { ... } block in AQL. It references a field in the given document (or alias) and wraps it with the TO_BOOL() function, ensuring the value is interpreted as a boolean in AQL.

If $keyName is not provided, the $key parameter is used as both the resulting key in the object and the field name in the document.

Example usage:

// PHP call
aqlFieldBool('isActive');

// Generates
isActive: TO_BOOL(doc.isActive)
Parameters
$key : string

The key to use in the resulting AQL object (e.g. "isActive").

$doc : string = AQL::DOC

The document alias or variable name to reference (default: AQL::DOC).

$keyName : string|null = null

Optional field name in the document; if omitted, $key is used.

Tags
since
1.0.0
author

Marc Alcaraz

Return values
string

AQL key/value expression, e.g. "isActive: TO_BOOL(doc.isActive)".

On this page

Search results