Oihana PHP Arango

UpsertType uses ConstantsTrait

Defines the type of operation performed during an UPSERT in ArangoDB.

This class provides constants to indicate whether a document was:

  • inserted (INSERT)
  • updated (UPDATE)
  • replaced (REPLACE)

These values can be used, for example, in conjunction with Clause::WITH_STATUS to return the type of operation in an UPSERT query:

Example usage:

$query = $this->upsert([
    'search' => [['foo', 'bar']],
    'insert' => [['foo', 'bar']],
    'update' => [['foo', 'baz']],
    'return' => Clause::WITH_STATUS
]);

// The RETURN clause will produce:
// RETURN { doc: NEW, type: OLD ? UpsertType::UPDATE : UpsertType::INSERT }

Table of Contents

Constants

INSERT  : string = 'insert'
Document was inserted because no match was found.
REPLACE  : string = 'replace'
Document was replaced (entire document overwrite).
UPDATE  : string = 'update'
Document was updated (partial update of existing fields).

Constants

INSERT

Document was inserted because no match was found.

public string INSERT = 'insert'

REPLACE

Document was replaced (entire document overwrite).

public string REPLACE = 'replace'

UPDATE

Document was updated (partial update of existing fields).

public string UPDATE = 'update'
On this page

Search results