> 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.add.md).

# Table.add()

Adds an object to the object store.

#### Syntax

```javascript
table.add(item, [key])
```

#### Parameters

| item | Object to add |            |
| ---- | ------------- | ---------- |
| key  | Primary key   | *optional* |

#### Return Value

Promise

#### Remarks

Add a given object to the object store. If an object with the same primary key already exists, then the operation will fail and the returned promise catch() callback will be called with the error object. If the operation succeeds, then the returned promise then() callback receives the result of the `add` request on the object store, i.e. the `id` of the inserted object.

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, then the operation will fail and the returned promise will be a rejection.

#### See Also

Table.put()
