I'm getting started with PouchDB and I'm using the BulkDocs function, this is used to insert bulk data in the database, documented here: https://pouchdb.com/guides/bulk-operations.html.
Works pretty well, but, as the documentation itself says, it is the same as calling a series of chained put() functions.
The problem with this is that I'm also using couchdb's changes function to listen for changes in the database and update the UI, with this:
db.changes({
since: 'now',
live: true,
}).on('change', refreshCarList);
When I call the bulk update, it triggers the 'change' event multiple times (once for every updated document) and depending on the bulk size, hundreds or even thousands of times at every save. This results on calling the callback multiple times, freezing my UI.
My question is: is there a way/option/hack to make bulk update call changes just once?