> For the complete documentation index, see [llms.txt](https://dexiejs.typogram.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dexiejs.typogram.co/table/table.put.md).

# Table.put()

Adds a new object to the object store or replaces an existing object in the object store.

#### Syntax

```javascript
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()
