# Delete Database Data

The Delete database data is a function on the [Cloud Database](https://docs.apphive.io/apphive-documentacion/reference/base-de-datos/database) group, this function allows you to delete specific records on the database or the hole collection

![](https://1781865142-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LvaO9X8rr2FG8JwKkhC-1769347644%2Fuploads%2Fgit-blob-ed871622e3c64888d1c2dc4f306b93cdc6f76b55%2FCaptura%20de%20Pantalla%202020-02-03%20a%20la\(s\)%2016.03.27.png?alt=media)

### 📥 Entry vars

* **Database path to delete.** Te permite abrir el [editor de la base datos](https://docs.apphive.io/apphive-documentacion/reference/base-de-datos/database-editor) para seleccionar la colección o el dato a eliminar
* **Should update db cache.** Si en alguna consulta de la base de datos de cloud se agregó caché, a activar está opción tambien actualizará ese caché

{% hint style="danger" %}
If you don't set any specific data index all the data in the collection will be deleted
{% endhint %}

### ↗ Callbacks

* **Error deleting data.** This callback is called when for some reason it is not possible to delete the data from the database
  * La variable de salida será la razon por la cual no se pudo eliminar los datos
* **Data deleted.** This is called once the database record (s) have been deleted successfully.

### 👉 Examples.

#### Deleting a full collection

In this example we deleted all the products in the database when the page loads

![](https://1781865142-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LvaO9X8rr2FG8JwKkhC-1769347644%2Fuploads%2Fgit-blob-d8a1363b985741e59f518815b073ae002e79885e%2FExample%20delete%20database%20data.gif?alt=media)

#### Deleting a single record

To delete a single record you must have the id of the record you want to delete, in this example we have a product detail and you have the product id as a "Page context data"

![](https://1781865142-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LvaO9X8rr2FG8JwKkhC-1769347644%2Fuploads%2Fgit-blob-f85322157e76273600777199d50fa3dd0e16ae3d%2FDelete%20single%20record.gif?alt=media)
