8.0.0
We are thrilled to announce the release of PouchDB's new major version 8.0.0. For a full changelog from 7.3.1 to 8.0.0, please see the releases page or view the latest commits. Here are the highlights:
Embracing modern ES6+ JS syntax
We have started the process of moving to ES6+ syntax. We made refactors to use native JS classes instead of prototypes, deprecated some packages that implemented features that are now built in the language (inherits, argsarray), and started in packages such as pouchdb-abstract-mapreduce and pouchdb-adapter-http. We encourage you to embrace the syntax in your new contributions and, if you can, contribute to the refactoring effort.
This might mean a potentially breaking change, therefore we bump the major version. If you need to support ES5 we recommend you use a transpiler.
Add activeTasks
#8422 #8441 Analogous to the _active_tasks feature in CouchDB, PouchDB now has activeTasks. With this functionality, PouchDB is able to list all active database tasks, like database_compaction, view_indexing, or replication. PouchDB will report the progress of these tasks to the active tasks API and remove tasks as soon as they are completed or have failed.
Example usage:
let tasks = PouchDB.activeTasks.list()
Example result:
[{
"id": "d81fea92-8ce4-42df-bb2b-89a4e67536c3",
"name": "database_compaction",
"created_at": "2022-02-08T15:38:45.318Z",
"total_items": 12,
"completed_items": 1,
"updated_at": "2022-02-08T15:38:45.821Z"
}]
Add purge to the indexeddb adapter
#8453 Similar to CouchDB's purge, PouchDB has now purge for its indexeddb adapter.
Purge permanently removes data from the database. Normal deletion with db.remove() does not, it only marks the document as _deleted=true and creates a new revision. This behaviour ensures that deletes can be replicated across databases, and deleted documents don’t get undeleted by syncing with a database that still has this document.
db.purge() is not intended as a regular method for deleting documents, instead, it is meant as an admin function for cases where some secret was erroneously added to the database and must now be removed completely, eg. a credit card or social security number. Purge effectively puts the database in a state where the offending write never happened.
Example usage:
try {
const result = await db.purge('mydoc', '6-3a24009a9525bde9e4bfa8a99046b00d');
// handle result
} catch (error) {
// handle error
}
Example result:
{
"ok": true,
"deletedRevs": [
"6-3a24009a9525bde9e4bfa8a99046b00d",
"5-df4a81cd21c75c71974d96e88a68fc2f"
],
"documentWasRemovedCompletely": false
}
Changelog
New features
- 0680c0ac feat(core): simple active tasks implementation
- c3fc43cc feat: use activeTasks error handling
- 9a83c11f feat(core): activeTasks remove reason argument
- 40dc6b37 feat(replicate): track live replications in activeTasks
- f5b6d35e feat(core): view indexing use activeTasks API
- d784b49a feat(replicate): replication uses activeTasks API
- 52a52495 feat: database compaction use activeTasks API
Bugfixes
- 34a79749 fix: check replication currentBatch
- 8f33ff0a fix: add activeTask stub to mock replication database
- 3fe71b03 (#8491) - Fix $regex and $ne within $or operator
- 86ccf481 fix(core): active tasks object datastructure
- 5f61b1fe fix partial filter find on indexeddb adapter
- 759ea5a0 fix: store
partial_filter_selectorin ddocs - 9519c748 fix: active tasks race condition
Documentation
- 7c6753a6 Mark a few words in the 7.3 post as code so that markdown does not italicise them
- 486076d2 Fix formatting of 7.3 release post by adding blank lines
- c6719367 Add new author in the docs
- 9cc72318 Add 7.3.0 release post
- 140896cb feat: update site version to 7.3.0
- d9c19182 docs: update PouchDB on page
- 2afc29f7 docs: release script note
- docs: clarify release process
Testing
- a3bf8ff0 test(#8522): add failing test for partial index
- 69ce67ad chore(core): lint activetasks code and tests
- 5fd15227 test(purge): unit tests for findPathToLeaf util
- 621cf0a1 wip: multi-root tree purge tests
- f28b4ad5 [wip] failing test showing bug in tracking node position in removeLeafFromTree()
- 868937d8 tests(purge): fix tests for fixed multi-root removals
- 63026167 chore(purge): lint
Dependency updates
Refactor
- 7350a701 refactor: use es6 classes
- 08e46002 refactor: deprecate inherits in pouchdb-core
- 99ebea32 refactor: use class in sublevel-pouchdb
- d4ff99b4 refactor: use classes instead of prototypes
- 21d7975c feat(core): refactor ActiveTasks with ES6 classes
- 07d055ae refactor: use rest parameters in find utils
- d02eaaf0 refactor: remove argsarray usage
- refactor: use await in abstract-mapreduce
Other changes
Get in touch
As always, we welcome feedback from the community and would love to hear what you think of this release as well as PouchDB's future direction. Please don't hesitate to file issues, open discussions or get in touch. And of course, a big thanks to all of our new and existing contributors!