matches.php
Table of Contents
Functions
- matches() : string
- Test whether a document matches one of the given example documents.
Functions
matches()
Test whether a document matches one of the given example documents.
matches(string $document, string|array<string|int, mixed> $examples[, bool|null $returnIndex = null ]) : string
Wraps the ArangoDB AQL function MATCHES(document, examples, returnIndex). The
examples argument is emitted as a JSON literal when given as a PHP array; a string
is passed through as a raw AQL expression. With $returnIndex = true, the function
returns the (zero-based) index of the first matching example instead of a boolean.
Example AQL usage:
MATCHES(doc, {age: 30}) // true if doc.age == 30
MATCHES(doc, [{age: 30}, {age: 40}], true) // index of the first matching example, or -1
Parameters
- $document : string
-
The document variable or expression to test.
- $examples : string|array<string|int, mixed>
-
A single example or a list of examples (array literal or AQL expression).
- $returnIndex : bool|null = null
-
Whether to return the matching example index instead of a boolean.
Tags
Return values
string —The formatted AQL expression.