Oihana PHP Arango

isSameCollection.php

Table of Contents

Functions

isSameCollection()  : string
Test whether a document identifier belongs to a given collection.

Functions

isSameCollection()

Test whether a document identifier belongs to a given collection.

isSameCollection(string $collectionName, string $documentIdentifier) : string

Wraps the ArangoDB AQL function IS_SAME_COLLECTION(collectionName, documentIdentifier). The collection name is emitted as a quoted string literal (json_encode); the document identifier stays a raw expression (typically doc._id).

Example AQL usage:

IS_SAME_COLLECTION("products", "products/123")   // returns true
IS_SAME_COLLECTION("products", doc._id)          // true if doc lives in products
Parameters
$collectionName : string

The collection name (emitted as a quoted string literal).

$documentIdentifier : string

A document handle / _id expression or string literal.

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

$expr = isSameCollection('products', 'doc._id');
// Produces: 'IS_SAME_COLLECTION("products",doc._id)'
see
https://docs.arangodb.com/stable/aql/functions/document-object/#is_same_collection
since
1.1.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results