New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot override bulkDocs anymore in custom Plugin with version 8.0.0 #8594
Comments
Any news on this issue? Custom plugins are not working anymore. |
I had the same issue and independently came to the same conclusion until I found this Github issue 🤦. I suspect that it could do with the fact that the prototypes are being defined in Update: I am petty sure the issue arises from the fact that in the constructor, all the core methods are redefined, which would override the prototype defined by the plugin. I think this could be solved by either passing the plugins to the constructor, saving the plugins and applying them after the constructor, or saving and re-applying the prototype at the end of the constructor |
Issue
According to the documentation:
https://pouchdb.com/api.html#plugins
Example Plugin: Intercept Updates
A useful feature of plugins is to intercept updates before they are stored in PouchDB. In this way, a plugin might validate that the data is correct for the application, or even alter documents before they are committed to the database.
The best way to intercept all updates to a PouchDB database is to override the bulkDocs() method. All changes to PouchDB documents ultimately pass through the bulkDocs() method. For example, a call to put() will become a bulkDocs() call with a “batch” of one document.
Because PouchDB guarantees to plugin authors that all data changes ultimately happen via bulkDocs(), it is the ideal place for an application or plugin to intercept updates.
The problems are that now with version 8.0.0:
and
it's not overriding the bulkDocs with validBulkDocs anymore (the original one will be called).
Info
The text was updated successfully, but these errors were encountered: