layout: post
title: PouchDB 5.4.0 author: Nolan Lawson
I'm happy to announce PouchDB 5.4.0, which is a minor release with a few new features, many bugfixes, and a handful of deprecations.
The big feature of 5.4.0 is the new Custom Builds API, which has its own separate introductory blog post. This post serves mostly as a changelog and summary.
One major bugfix is that PouchDB now supports Node 6. For those who have opted to stick with Node 5, it is certainly the more stable choice (or even better: Node 4, which is an LTS release), but feel free to upgrade to Node 6 now if you're feeling adventuresome.
Another milestone is that PouchDB is now tested at 100% code coverage, and the build will actually fail if it ever drops below that. Big props to Dale Harvey for the massive amount of effort he's put into the test infrastructure to reach this point.
Another change that fellow library authors may find interesting: we are now building in Node 5 but testing in other versions. This means that our build dependencies do not need to support “troublesome” versions of Node such as 0.10 or 6; only our runtime dependencies need to.
We have outright removed some undocumented APIs, and added warnings for some (formerly) documented APIs. Please read carefully in case you are using any of these features.
Deprecation #1: PouchDB.utils, PouchDB.ajax, PouchDB.Errors
We have removed the PouchDB.utils, PouchDB.ajax, and PouchDB.Errors APIs. These were always undocumented and unsupported, and we regret if anybody accidentally ended up relying on them.
If you are using these APIs you can now require them directly as so:
var PouchDB = require('pouchdb'); PouchDB.utils = { promise: require('pouchdb-promise') }; PouchDB.ajax = require('pouchdb-ajax'); PouchDB.Errors = require('pouchdb-errors');
Alternatively you can look at the Custom Builds API instead.
Deprecation #2: db.put(doc, id, rev)
db.put({}, 'myid', '2-xxx');
Instead of doing this, please put the _id and _rev on the document itself:
db.put({_id: 'myid', _rev: '2-xxx'});
This API was not removed, but will log a warning if you try to use it.
Deprecation #3: new PouchDB(dbName, callback)
var db = new PouchDB('mydb', function (err) { // called when PouchDB has asynchronously finished setting up // (or has errored) });
Instead of using this format (which has been undocumented and unrecommended for some time), please do:
var db = new PouchDB('mydb'); db.info().then(function () { // db is now ready }).catch(/* ... */);
There is no need to “wait” for the PouchDB constructor to asynchronously finish setting up, since the constructor has been made stateless. However, if you really want to verify that the database is ready and working, you can do an info() request.
This API was not removed, but will log a warning if you try to use it.
As always, please file issues or tell us what you think. And of course, a big thanks to all of our new and existing contributors!