Table.put()

Adds a new object to the object store or replaces an 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, then it will be replaced with the given object. If the object does not exist, then it will be added.

The optional second key argument must only be used if the table uses outbound keys. If providing the key argument on a table with inbound keys, then 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()