Releases: pouchdb/pouchdb
5.4.0
Deprecations
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, please switch to 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.
New features
Bugfixes
- (#3539) - Ensure throw in user code does not effect pouch
- (#5272) - Fix checkpointing against Cloudant/CouchDB 2.0
- (#5225) - Guard uses of console before calling it
- (#5238) - Fix unhandled rejection in changes
- (#3923) - Add ability to set url as prefix
- (#4922) - Do not call 'destroyed' twice for http instances
- (#3609) - opts.view implies filter=_view
- (#4444) - Dont leak event emitters
- (#5197) - detect WebSQL invalid on WKWebView
- (#5200) - Don't clone special objects like Workers
- (#5196) - fix excessively long replication loop
- (#5157) - avoid launching more requests than browser can perform
- (#5140) - remove use of buffer.toArrayBuffer()
- (#5118) - Revert "(#4867) - Cache ddoc views and filters"
- (#2674) - avoid unneeded attachment GET requests
Deprecations
- (#5251) - Add deprecation notice for async constructor
- (#5154) - Add deprecation notice for db.put(doc, id, rev)
Documentation
- (#5094) - Remove editable title from home page
- (#5089) - Fix the install jekyll script
- (#4199) - add a download specific page
- (#5084) - Use bundler to install jekyll dependencies
- (#5083) - Saving of 12kb in payload if site css is minified
- (#5080) - Fix docs replication batch_size
- (#5082) - Remove references to iriscouch (#5234)
- (#4493) - Mention implication of views on size param (#5241)
- (#5080) - Clarify batch_size documentation
- (#4573) - Remove outdated Firefox Inspector link
Testing
5.3.2
Bugfixes
- (#4991) - Move websql as optional dependency
- (#5010) - Update cache-busting for Safari Technology Preview
- (#4979) - allow passing any option to SQLite Plugin
- (#4963) - Fail entire replication batch if any docs within the batch fail
- (#2709) - support
revpos
in attachment stubs - (#5042) - include ajax options in bulkGetShim get() calls
- (#5061) - ajax returns ETIMEDOUT error on timeout
5.3.1
- fix prefix usage in node-websql (#4966)
This may be interpreted as a breaking change, if you are already using the node-websql
adapter in production and have saved your data somewhere, within the span of time between 5.3.0 and 5.3.1. (Unlikely, hence the patch change.) If so, you can migrate by simply doing:
mv _pouch_my_database_name my_database_name
The difference is that we are no longer using the _pouch_
prefix, which was not designed to be used in Node.js environments (only in the browser).
5.3.0
Features
- Support WebSQL in Node via node-websql (#4915)
Bugfixes
- Escape unicode in auth header (#4903)
- Fix cache-busting in Edge (#4827)
- Better error when trying to re-use a destroyed database (#4339)
- Cache ddoc views and filters (#4867)
- Allow creating databases with reserved words (#4898)
- Fix missing key in ungrouped (custom) reduce functions (#4878)
- Fix leaking of stemmed revisions (#4372)
5.2.1
Bugfixes
- (#4815) - Fix ajax/ajax-browser switch
- (#4767) - Fix path to adapter plugins
- (#4788) - Fix for sync .type() access
- (#4798) - Use "files" instead of .npmignore, reduce tgz size
- (#4801) - Fix global PouchDB object usage
- (#4764) - Improve replication for read-only source databases
- (#3824) - Fix for triple request with replication
5.2.0
Features and improvements
- Implement
revs_limit
(#2839) - Migrate to ES6/Rollup, build one
index.js
(#4652) - Add ability to disable timeout in
changes()
(#4583)
Bugfixes
- Return conflict error when inserting an unknown rev (#4712)
- Catch XHR errors and propagate (#4595)
- Fix and test Webpack (#4700)
- Improve error when user sends invalid base64 (#4208)
- Consider changes erroring a valid result (#4677)
- Allow bulkGet requests without an explicit rev (#4530)
- Fix for xhr.upload detection failing (#4560)
- Coerce options which should be numbers to number (#4578)
- Add timeout option to replication (#4540)
- Remove binary string conversion (#4529)
- Remove CORS explanation (#4677)
- Add browser sniffing and remove nonce by default (#4543)
- Remove unneeded host.headers from ajax (#4567)
- Fix double-encoding name in http adapter (#4514)
- Fix and document heartbeat for replication (#4538)
- Fallback from
_bulk_get
on 50x requests (#4542) - Remove Cordova init checks (#4756)
- Reset
changedDocs
inwrite_docs
(#4627)
5.1.0
Coverage
We are now very happy to be hitting 100% coverage on our tests. This currently only covers Node.js and excludes some cases that are difficult to test but it does give us confidence that our shared code is very well tested and we can ensure new code that is merged has the same level of testing.
GreenKeeper
We have had issues in the past with how to manage npm dependencies. Version ranges can lead to other people breaking PouchDB with their releases, and strict versions lead to us using stagnant packages and not being aware of upcoming breakages. During this month, the hood.ie team released GreenKeeper which gives us best of both worlds, stable versions that are always kept up to date!
New features
- Add an option to configure
withCredentials
on CORS requests (#2513) - Allow user to disable
heartbeat
in HTTP requests (#4490)
Bugfixes
- Explain http error caused by checking for
_bulk_get
(#4435) - Dont create a database just to delete it (#4467)
- Add friendly err msg to common leveldown err (#4447)
- Avoid empty bulkGet() (#4474)
- Fix http url with port 80 (#247)
- Url encode http database name (#4314)
- Handle invalid view name consistently (#4451)
- Remove put implementation and fix local doc handling (#1526)
- Fix cross origin check (#4501)
Get in touch
Please file issues or tell us what you think. And as always, a big thanks to all of our new and existing contributors!
5.0.0
Deprecations
- Remove
PouchDB.destroy()
(#4223)
Having a destroy()
function on the PouchDB
object was always a little awkward, which is why we introduced the db.destroy()
alternative. So now that PouchDB.destroy()
is out, upgrading your code should look like this:
PouchDB.destroy('mydb');
becomes:
new PouchDB('mydb').destroy();
Keep in mind that the PouchDB
object is no longer usable after you destroy()
it. So you should call new PouchDB()
again if you want to re-use it.
- Remove CRUD events (#4224)
These events ('create'
, 'update'
, and 'delete'
) were intended to make the changes()
API easier to work with, but they ended up being too ambitious and confusing, so 5.0.0 removes them.
If you are relying on these events, then you can upgrade like so:
db.changes({live: true})
.on('create', createListener)
.on('update', updateListener)
.on('delete', deleteListener);
becomes:
db.changes({live: true})
.on('change', function (change) {
if (change.deleted) {
deleteListener(change);
} else if (change.changes.length === 1 &&
/^1-/.test(change.changes[0].rev)) {
createListener(change);
} else {
updateListener(change);
}
});
Keep in mind that this "update vs. create" test is not foolproof (what happens if a 2-
document is the first version that gets synced? what happens if two conflicting 1-
revisions are synced?), but it will match the old behavior.
Most of the time, your UI should be able to handle document "updates" or "creates" equivalently, so change.deleted
becomes the only special case. See Efficiently managing UI state with PouchDB for some details about how to do this.
- Remove
idb-alt
plugin (#4222)
This was an alternative IndexedDB adapter based on Level.js, which was experimental and probably unused by anyone except the PouchDB developers themselves.
New features
- Implement
bulkGet()
(#3424) - Add FruitDOWN as a supported adapter (#4329)
- Allow user to specify Firefox persistent storage (#4315)
- Allow setting http options per request (#3941)
Bugfixes
- Maintain canceled state in replicator better (#4276)
- Don't mutate binary objects provided by the user (#3955 #4273)
- Fire events on sync, eensure we only fire one active event (#4251)
- Catch errors from WebSQL
openDatabase()
(#4018) - Ensure setup errors propagate to the API (#4358)
- Prevent replication firing extra events (#4293)
- Proper propagation of quota exceeded errors (#4018)
- Remove
'use strict'
fromeval()
(#4344) - Alias
skip_setup
toskipSetup
(#3535) - Fix options usage within http adapter (#4313)
- Fix Firefox
FileReader
usage in a web worker (#4402)
4.0.3
4.0.3 is a very very small patch release to fix some issues with how 4.0.2 was published to Bower and JSDelivr. It is exactly the same as 4.0.3.
4.0.2
Bugfixes
- Handle errors thrown from
filter
functions (#3356) - Upgrade
levelup
to 1.2.1,leveldown
to 1.4.1, andlevel-sublevel
to 6.5.0 (#3873) - Stateless constructor for the HTTP adpater, fixes errors syncing while offline (#4146)
- Ensure document properties are maintained, e.g. docs with keys like
hasOwnProperty
(#3968) - Validate attachment names don't start with
_
(#3357) - Correctly respect the
revs_limit
of 1000, trim revision trees (#4204) - Allow passing in opts to
destroy()
(#4219) - Update
request
to 2.61.0 (#4260) - Use
Function.prototype.name
shim consistently for IE (#4216) - Better CORS warning (#4256)