tuple_object:update() | Tarantool



object tuple_object
tuple_object:update({{operator, field_no, value}, ...})

Update a tuple.

This function updates a tuple which is not in a space. Compare the function, {{format, field_no, value}, ...}) which updates a tuple in a space.

For details: see the description for operator, field_no, and value in the section{key, format, {field_number, value}…).

If the original tuple comes from a space that has been formatted with a format clause, the formatting will be preserved for the result tuple.

  • operator (string) – operation type represented in string (e.g. ‘=’ for ‘assign new value’)
  • field_no (number) – what field the operation will apply to. The field number can be negative, meaning the position from the end of tuple. (#tuple + negative field number + 1)
  • value (lua_value) – what value will be applied

new tuple



In the following example, a tuple named t is created and then its second field is updated to equal ‘B’.

tarantool> t ={'Fld#1', 'Fld#2', 'Fld#3', 'Fld#4', 'Fld#5'}
tarantool> t:update({{'=', 2, 'B'}})
- ['Fld#1', 'B', 'Fld#3', 'Fld#4', 'Fld#5']

Since Tarantool 2.3 a tuple can also be updated via JSON paths.