Adds new or replaces existing object in the object store.

Syntax

table.put(item, [key])

Parameters

item Object to add
key Primary key optional

Return Value

Promise

Remarks

If an object with the same primary key already exists, it will be replaced with the given object. If it does not exist, it will be added.

The optional second key argument must only be used if your table uses outbound keys. If providing the key argument on a table with inbound keys, the operation will fail and the returned promise will be a rejection.

If the operation succeeds then the returned Promise resolves to the key under which the object was stored in the Table.

See Also

Table.update()

Table.add()

Collection.modify()

Table of Contents