Class: PartialUpdateBuilder

partialupdate.PartialUpdateBuilder(operations)

new PartialUpdateBuilder(operations)

Parameters:
Name Type Description
operations json
Source:

Members

operations :Array.<UpdateOperation>

Type:
  • Array.<UpdateOperation>
Source:

Methods

add(field, item) → {this}

Adds an item to a set

Parameters:
Name Type Description
field string

The field to perform the operation on

item *

The item to add

Source:
Returns:
Type
this

and(path, bitmask) → {this}

Performs a bitwise AND on a path

Parameters:
Name Type Description
path string

The path to perform the operation on

bitmask number

The bitmask taking part in the operation

Source:
Returns:
Type
this

atLeast(field, value) → {this}

Sets the smallest possible value of a field

Parameters:
Name Type Description
field string

The field to compare with

value number

The smalles possible value

Source:
Returns:
Type
this

atMost(field, value) → {this}

Sets the highest possible value of a field

Parameters:
Name Type Description
field string

The field to compare with

value number

The highest possible value

Source:
Returns:
Type
this

currentDate(field) → {this}

Sets a datetime field to the current moment

Parameters:
Name Type Description
field string

The field to perform the operation on

Source:
Returns:
Type
this

dec(field, byopt) → {this}

Decrements a field by a given value

Parameters:
Name Type Attributes Description
field string

The field to decrement

by number <optional>

The number to decrement by, defaults to 1

Source:
Returns:
Type
this

decrement(field, byopt) → {this}

Decrements a field by a given value

Parameters:
Name Type Attributes Description
field string

The field to decrement

by number <optional>

The number to decrement by, defaults to 1

Source:
Returns:
Type
this

div(field, divisor) → {this}

Divides a field by a given number

Parameters:
Name Type Description
field string

The field to divide

divisor number

The number to divide by

Source:
Returns:
Type
this

divide(field, divisor) → {this}

Divides a field by a given number

Parameters:
Name Type Description
field string

The field to divide

divisor number

The number to divide by

Source:
Returns:
Type
this

(abstract) execute() → {Promise.<T>}

Executes the partial update

Source:
Returns:

The promise resolves when the partial update has been executed successfully

Type
Promise.<T>

inc(field, byopt) → {this}

Increments a field by a given value

Parameters:
Name Type Attributes Description
field string

The field to increment

by number <optional>

The number to increment by, defaults to 1

Source:
Returns:
Type
this

increment(field, byopt) → {this}

Increments a field by a given value

Parameters:
Name Type Attributes Description
field string

The field to increment

by number <optional>

The number to increment by, defaults to 1

Source:
Returns:
Type
this

max(field, value) → {this}

Sets the smallest possible value of a field

Parameters:
Name Type Description
field string

The field to compare with

value number

The smalles possible value

Source:
Returns:
Type
this

min(field, value) → {this}

Sets the highest possible value of a field

Parameters:
Name Type Description
field string

The field to compare with

value number

The highest possible value

Source:
Returns:
Type
this

mul(field, multiplicator) → {this}

Multiplies a field by a given number

Parameters:
Name Type Description
field string

The field to multiply

multiplicator number

The number to multiply by

Source:
Returns:
Type
this

multiply(field, multiplicator) → {this}

Multiplies a field by a given number

Parameters:
Name Type Description
field string

The field to multiply

multiplicator number

The number to multiply by

Source:
Returns:
Type
this

or(path, bitmask) → {this}

Performs a bitwise OR on a path

Parameters:
Name Type Description
path string

The path to perform the operation on

bitmask number

The bitmask taking part in the operation

Source:
Returns:
Type
this

pop(field) → {this}

Pops the last item out of a list

Parameters:
Name Type Description
field string

The field to perform the operation on

Source:
Returns:
Type
this

push(field, item) → {this}

Pushes an item into a list

Parameters:
Name Type Description
field string

The field to perform the operation on

item *

The item to add

Source:
Returns:
Type
this

put(field, key, valueopt) → {this}

Puts an item from an array or map

Parameters:
Name Type Attributes Description
field string

The field to perform the operation on

key string | object

The map key to put the value to or an object of arguments

value * <optional>

The value to put if a key was used

Source:
Returns:
Type
this

remove(field, item) → {this}

Removes an item from an array or map

Parameters:
Name Type Description
field string

The field to perform the operation on

item *

The item to add

Source:
Returns:
Type
this

rename(oldPath, newPath) → {this}

Renames a field

Parameters:
Name Type Description
oldPath string

The old field name

newPath string

The new field name

Source:
Returns:
Type
this

replace(path, index, item) → {this}

Replaces an item at a given index

Parameters:
Name Type Description
path string

The path to perform the operation on

index number

The index where the item will be replaced

item *

The item to replace with

Source:
Returns:
Type
this

set(field, value) → {this}

Sets a field to a given value

Parameters:
Name Type Description
field string

The field to set

value *

The value to set to

Source:
Returns:
Type
this

shift(field) → {this}

Shifts the first item out of a list

Parameters:
Name Type Description
field string

The field to perform the operation on

Source:
Returns:
Type
this

toJSON() → {json}

Returns a JSON representation of this partial update

Source:
Returns:
Type
json

toNow(field) → {this}

Sets a datetime field to the current moment

Parameters:
Name Type Description
field string

The field to perform the operation on

Source:
Returns:
Type
this

unshift(field, item) → {this}

Unshifts an item into a list

Parameters:
Name Type Description
field string

The field to perform the operation on

item *

The item to add

Source:
Returns:
Type
this

xor(path, bitmask) → {this}

Performs a bitwise XOR on a path

Parameters:
Name Type Description
path string

The path to perform the operation on

bitmask number

The bitmask taking part in the operation

Source:
Returns:
Type
this