> For the complete documentation index, see [llms.txt](https://simpldb.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simpldb.js.org/v1/documentation/database/add.md).

# .add()

Adds the provided value to the value of the provided key. If no existing number, the provided value will be added to 0 (zero).

### add(key, value)

| Parameter | Description                                                                                                                                                            |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| key       | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></p><p>The key that will have its value incremented</p> |
| value     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></p><p>The value to increment</p>                       |

| Returns                                                                                                                                                                                                | Description                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- |
| [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | The updated data from the provided key's root |

####

```javascript
db.get('balance'); // 350

db.add('balance', 500); // 850
```

Also allows the use of dot notation:

```javascript
db.get('account'); // { owner: '5antos', balance: 800 }

db.add('account.balance', 200); // { owner: '5antos', balance: 1000 }
```
