Alba Herrerías

By: Alba Herrerías
Published: 13 April 2022

We're happy to announce the release of PouchDB 7.3.0, bringing in features, fixes and dependency updates. For a full changelog from 7.2.2 to 7.3.0, please see the releases page or view the latest commits. Some of the highlights:

Improving testing

We have been investing lots of time into our test suites, with around 36 commits, 112 files changed, 3314 insertions and 2064 deletions made about this topic. We have:

  • Migrated from Travis CI to Github Actions, which has improved the speed, throughput and reliability of our CI.
  • Rewrote TESTING.md documentation.
  • Upgraded eslint configuration in order to use ES6 syntax within our tests. Feel free to incorporate newer syntax (such as async/await) into your new tests contributions.
  • Fixed bugs in CI configuration: ADAPTERS and GREP variables weren't working correctly, background servers being started incorrectly, build failure caused by an older version of pouchdb-express-router.
  • Unified the configuration variables used in the build.
  • Fix the majority of non-deterministic tests to substantially reduce random failure during CI runs, and put in tooling for retrying failed tasks. This includes improving tests that check behaviour for unreachable servers, which previously relied on a third party service being available.
  • Restructured the CI tasks so that each task exercises a single backend (i.e. CouchDB server version or client-side PouchDB adapter), rather than some combination of local and remote adapters. This reduces the impact of flaky tests, reduces the duration of each task, reduces redundant tasks repeating the same work, and allows more parallelisation of tests.
  • Improved the test coverage across target platforms, including cross-browser tests, different Node.js versions, and different CouchDB versions. We have fixed tests that assume CouchDB v1.x behaviour so that they now work on v2.x and v3.x.
  • Allowed the indexeddb adapter to be loaded and used during tests

Add indexeddb adapter in the default distribution

The indexeddb adapter is now available in the default distribution. You can use it specifying the adapter:

PouchDB.plugin(require('pouchdb-adapter-indexeddb'));
const db = new PouchDB('mydb', {adapter: 'indexeddb'});

Please note that it is considered BETA quality, use it carefully and please report any issues you find. Thank you.

Add view_update_changes_batch_size

#8320 With view_update_changes_batch_size, we can now specify how many change records will be consumed at a time when rebuilding view indexes when the query() method is used.

Support partial_filter_selector

#8276 #8277 Now PouchDB-find supports partial_filter_selector.

Indexing event to show the progress of view updates

#8321 We can now subscribe to an indexing event, which will emit a progress object containing the properties view, last_seq, results_count and indexed_docs.

Checkpoint events during replication

#8324 During replication, we can subscribe to checkpoint events, which will emit the following properties: checkpoint, revs_diff, start_next_batch and pending_batch.

Add style to replication options

#8380 #8379 We expose changes feed style to replication options.

Add view_adapter option

#8335 view_adapter provides an option for the user to specify a separate adapter to store their view index in addition to the main adapter for their core data:

const db = new PouchDB(DB_NAME, {adapter: 'idb', view_adapter: 'memory'});

Enable discussions and projects

In Github we have enabled:

  • Discussions: feel free to open and participate
  • Projects: we are keeping track of the issues and PRs for future releases.

Changelog

New features

  • 7cc1c8e3 (#8171) - Allow _access field in documents
  • b359d788 Let caller set the change batch size when updating views (#8320)
  • a9e2996b (#8277) - Support partial_filter_selector
  • 0875b19a Add an indexing event to show progress of view updates
  • fe9bd028 Add checkpoint events during replication
  • b523a1d2 (#8379) - Expose changes feed style to replication options (#8380)
  • (#8335) Add view adapter option

Bugfixes

  • b8d3fc65 (#8229) - indexeddb: ensure errors are propagated and handle database deletion
  • fe7ffa9c (#8237) - Conform pouchdb find operators to couchdb's (#8327)
  • 0e27e23f (#8222) - fix multiple $regex conditions on same field when using $and
  • ab451d9e (#8165) - Initial dollar sign escaped with unit tests.
  • f544c822 (#8242) - unhandled promise rejection in upsert
  • 62dd11bf (#8185) - Fix date checking
  • a6a34357 (#8187) - Don't include leveldown in browsers
  • 9bf13109 (#7331) - Close leveldb file handlers
  • be55391b (#8274) - rev() should clone only when needed
  • 8377ae00 (#8316) - Properly handle transaction abort
  • c4aaf255 Fix escaping of key path segments in indexeddb adapter (#8358)
  • 77d9782a Fix memory leak when replications fails
  • 73a9bad4 fix: add auto_compaction to indexeddb bulkDocs
  • (#8460) Fix writing erroneous attachment rev references in bulkDocs
  • (#8370) Implement skip and limit for keys query #8404
  • (#8473) Add stack to CustomPouchError (fix #8372)
  • (#8473) Add idb global database failure error as reason to transaction errors #8414

Documentation

Testing

  • 04d2a458 (#8227) - Remove saucelabs test runs
  • 095ada4f (#8319) - Fix node build ordering
  • 451e7ec4 (#8325) - Reduce the number of travis runs
  • 1e6cfa1a Update indexing event test to use async/await instead of callbacks
  • 9f5da871 Update checkpoint event test to use async/await instead of callbacks
  • 2218ed1c Parse query string into an object in webrunner.js
  • b39b98f7 Load adapters as plugins only if they are present in packages/node_modules/pouchdb/dist
  • 731a83ba Remove the ADAPTER variable from the browser test scripts and update CI config and docs
  • 7a8ff25f Replace remaining uses of ADAPTER in tests with ADAPTERS
  • efa56c8c Turn indexeddb into a plugin and make it loadable via the ADAPTERS option
  • 6c5d601a Run "find" tests against a single implementation at a time (#8359)
  • 4a9562d2 Quote arguments to mocha(1) to make GREP work correctly (#8363)
  • d9edb532 Fix mapreduce tests (#8365)
  • 453dd3e6 Consistent loading of PouchDB in tests (#8366)
  • 18c74c3e Migrate CI to GitHub Actions (#8368)
  • 55b5ee5b Add test for broken skip in pouch-find (#8371)
  • 566502c7 fix(test): skip test setup and assertions were wrong
  • 07376ded chore(test): uncomment test for future fix
  • 45413a6e chore: rename build node variable
  • c0771a7d fix: skip building node on webpack tests
  • 1fc976f7 Add webpack test to github actions
  • 469a4938 Fix mapreduce tests that assume bulkDocs() response order, which pouchdb-server does not guarantee
  • fc7f6855 Test for non-string values for views.*.map should pass on more recent CouchDB versions which do not reject the design doc on write, but fail on queries instead
  • 5b0903cb Add missing "npm test" command in mapreduce CI tasks
  • ea46e5a8 Run integration tests on Node.js, and with the memory adapter, and use ADAPTERS (plural) to set the adapter
  • 423124c0 Run integration tests against CouchDB and pouchdb-server
  • 4040b214 Add all the combinations for testing the pouchdb-find plugin to the CI matrix
  • 6893afd5 Build pouchdb-server correctly during tests on GitHub Actions
  • d3912687 Refactor the GitHub actions workflows
  • ac7bcc65 Do not run eslint after all tests, but make it a distinct task that other CI jobs depend on
  • 6786456d test: add couchdb 2.3 browser matrix
  • 1ba99d64 test: remove debugging logs
  • ad520298 feat: add down server, use it in tests
  • fc690dd4 test: refactor in replication test replicate from down server test
  • e7e3eff7 feat: add retries to failed jobs in gha ci
  • 31bc31f8 fix: node build on tests

Dependency updates

Other changes

  • 1ba87970 (#8167) - Revert Jekyll to 3.9.0 to be able to build doumentation (+ doc updates)
  • dfdb55e6 (#8219) - Update stale bot configuration
  • 1a48c541 Upgrade eslint ecmaVersion to 8
  • 1d8d7500 Update issue template's adapters
  • d5f47348 chore: fix eslint running at packages/node_modules
  • d143e02e chore: remove local, unneeded eslint config
  • b1742b1d chore: fix eslint no-prototype-builtins errors
  • 41d70ea8 Update README's build status badge
  • dae3e384 Add or update repository field in package.jsons

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!