aqlUpsert.php
Table of Contents
Functions
- aqlUpsert() : string
- Prepare the query to update an existing document, or creates a new document if it does not exist.
Functions
aqlUpsert()
Prepare the query to update an existing document, or creates a new document if it does not exist.
aqlUpsert([JsonSerializable|null} $init = [] ]) : string
UPSERT [ searchExpression | FILTER filterExpression ]
INSERT insertExpression
UPDATE updateExpression
IN collection
Options in $init :
- collection : The name of the collection
- filter : The alternative filterExpression, this syntax for UPSERT operations allows you to use more flexible filter conditions beyond equality matches to look up documents.
- search : The 'searchExpression' contains the document to be looked for. It must be an object literal (UPSERT {
: , ... } ...) without dynamic attribute names. In case no such document can be found in collection, a new document is inserted into the collection as specified in the insertExpression. - insert : The document to insert in the collection if the document not exist.
- update : The document to update in the collection.
- options : The optional upsert options definition array or object.
- return : optional expression to define the RETURN clause. Default is Clause::NEW. You can also use Clause::WITH_STATUS to return both the document and the type of operation.
Parameters
- $init : JsonSerializable|null} = []
-
Configuration options for the UPSERT query.
Tags
Return values
string —The generated AQL UPSERT query.