\CouchbaseMutateInBuilder

Represents a builder for subdocument mutation command.

Note: This class must be constructed by calling the mutateIn() method of the CouchbaseBucket class.

Summary

Methods
Properties
Constants
__construct()
insert()
upsert()
replace()
remove()
arrayPrepend()
arrayAppend()
arrayInsert()
arrayPrependAll()
arrayAppendAll()
arrayInsertAll()
arrayAddUnique()
counter()
execute()
$id
$cas
$id
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$commands
$bucket
N/A

Properties

$id

$id : string

Type

string — Unique identifier for the document

$cas

$cas : string

Type

string — Unique and opaque value which identifies current state of the document and regenerated on mutation. Useful to control integrity of the document.

$id

$id : integer

Type

integer

$commands

$commands : array

Type

array — List of chained commands

$bucket

$bucket : 

Type

Methods

__construct()

__construct(  $bucket,   $id,   $cas) 

Parameters

$bucket
$id
$cas

insert()

insert(string  $path, string  $value, boolean  $createParents = false) 

Inserts an element into a JSON document at a given path.

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

string $value

An array value, scalar or any other valid JSON item.

boolean $createParents

If true, the parent will be added to the document.

upsert()

upsert(string  $path, string  $value, boolean  $createParents = false) 

Inserts or updates an element within or into a JSON document at a given path.

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

string $value

An array value, scalar or any other valid JSON item.

boolean $createParents

If true, the parent will be added to the document.

replace()

replace(string  $path, string  $value) 

Replaces an element or value within a JSON document at a given path.

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

string $value

An array value, scalar or any other valid JSON item.

remove()

remove(string  $path) 

Removes an element or value from a JSON document at a given path.

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

arrayPrepend()

arrayPrepend(string  $path, mixed  $value, boolean  $createParents = false) 

Add a value to the beginning of an array at given path of a JSON document

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

mixed $value

An array value, scalar or any other valid JSON item.

boolean $createParents

If true, the parent will be added to the document.

arrayAppend()

arrayAppend(string  $path, mixed  $value, boolean  $createParents = false) 

Add a value to the end of an array at given path of a JSON document

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

mixed $value

An array value, scalar or any other valid JSON item.

boolean $createParents

If true, the parent will be added to the document.

arrayInsert()

arrayInsert(string  $path, mixed  $value) 

Insert a value at given path of an array in a JSON document

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

mixed $value

An array value, scalar or any other valid JSON item.

arrayPrependAll()

arrayPrependAll(string  $path, array  $values, boolean  $createParents = false) 

Add all values to the beginning of an array at given path of a JSON document

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

array $values

An array of array values, scalars or any other valid JSON items.

boolean $createParents

If true, the parent will be added to the document.

arrayAppendAll()

arrayAppendAll(string  $path, array  $values, boolean  $createParents = false) 

Add all values to the end of an array at given path of a JSON document

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

array $values

An array of array values, scalars or any other valid JSON items.

boolean $createParents

If true, the parent will be added to the document.

arrayInsertAll()

arrayInsertAll(string  $path, array  $values) 

Insert a value at given path of an array in a JSON document

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

array $values

An array of array values, scalars or any other valid JSON items.

arrayAddUnique()

arrayAddUnique(string  $path, string  $value, boolean  $createParents = false) 

Add a value to an array at given path of a JSON document if it does not exist yet

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

string $value

An array value, scalar or any other valid JSON item.

boolean $createParents

If true, the parent will be added to the document.

counter()

counter(string  $path, string  $delta, boolean  $createParents = false) 

Perform and arithmetic operation on a numeric value in a JSON document at given path

Parameters

string $path

A string (N1QL syntax) used to specify a location within the document

string $delta

The value to increment or decrement the original value by

boolean $createParents

If true, the parent will be added to the document.

execute()

execute()