> 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/v2.11.0/documentation/database/push.md).

# .push()

Pushes an element into an array based on the provided key.

### push(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 of the target array</p> |
| value         | <p><a href="https://simpldb.gitbook.io/docs/types-and-interfaces/jsondata">JSONData</a></p><p>The value to push into the array </p>                   |

| **Returns**                                                               | **Description**                               |
| ------------------------------------------------------------------------- | --------------------------------------------- |
| [JSONData](https://simpldb.gitbook.io/docs/types-and-interfaces/jsondata) | The updated data from the provided key's root |

####

```javascript
db.get('people'); // ['Peter', 'Henry']

db.push('people', 'Catherine'); // ['Peter', 'Henry', 'Catherine']
```

Also allows the use of dot notation:

```javascript
db.get('user'); // { id: 32171, items: ['sword'] }

db.push('user.items', 'axe'); // { id: 32171, items: ['sword', 'axe'] }
```
