Y
Y
Yurka Blokhin2017-03-03 12:18:39
JSON
Yurka Blokhin, 2017-03-03 12:18:39

How to delete an entry in lowdb?

The application used to use mongodb, now I decided to switch to lowdb. There were problems deleting the entry.

router.delete('/api/destroy/:id', function(req, res) {
    const id = req.params.id;
    db.get('botes').remove({ id }).write();
});

with this code, the ID turns out: { id: '1488528896322' }, as I understand it, to delete it is necessary that the ID turns out to be { id: 1488528896322 }, how to achieve this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rustler2000, 2017-03-03
@blrik

It is possible to bring the type:
```
const id = parseInt(req.params.id);
```

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question