Oihana PHP Arango

setDefaultQuery.php

Table of Contents

Functions

setDefaultQuery()  : string
Builds the AQL that backfills a default value on every document where a field is missing or `null` — the typical "new column" backfill.

Functions

setDefaultQuery()

Builds the AQL that backfills a default value on every document where a field is missing or `null` — the typical "new column" backfill.

setDefaultQuery(string $collection, string $field, mixed $value) : string

Emits FOR doc IN <collection> FILTER doc.<field> == null UPDATE doc WITH { <field>: <value> } IN <collection>. The value is JSON-encoded, so a string, number, boolean, array or object literal all work.

Pure: returns the query string, runs nothing.

Parameters
$collection : string

The collection name.

$field : string

The attribute to backfill.

$value : mixed

The default value (emitted as a JSON literal).

Tags
author

Marc Alcaraz (ekameleon)

since
1.2.0
Return values
string

The ready-to-run AQL query.

On this page

Search results