Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

don't fail when legacy API is not available

  • Loading branch information...
commit 9714ec943c3e3ae6ebaf39c620e58090eb994a38 1 parent ab8186b
Hendrik Schnepel authored
Showing with 13 additions and 0 deletions.
  1. +2 −0  README.md
  2. +11 −0 test/test-db.js
View
2  README.md
@@ -254,6 +254,8 @@ Wrapper for [GET /db-name/\_all\_docs](http://wiki.apache.org/couchdb/HTTP_Docum
### db.allDocsBySeq(query)
Wrapper for [GET /db-name/\_all\_docs\_by\_seq](http://wiki.apache.org/couchdb/HTTP_Document_API#all_docs_by_seq).
+Replaced by [GET /db-name\_changes](http://wiki.apache.org/couchdb/HTTP_database_API#Changes) as of CouchDB 0.11.
+Consider using `db.changes` or `db.changesStream`.
### db.compact([design])
View
11 test/test-db.js
@@ -130,6 +130,17 @@ db
// Test allDocsBySeq
db
.allDocsBySeq(function(er, r) {
+ /*
+ * An error here is perfectly valid as of CouchDB 0.11. The _all_docs_by_seq API
+ * has been replaced by _changes.
+ */
+ if (er && er.error == 'not_found' && er.reason == 'missing') {
+ callbacks.L = true;
+ return;
+ }
+ /*
+ * If there is as an error different from 404, it may still be a problem.
+ */
if (er) throw new Error(JSON.stringify(er));
callbacks.L = true;
assert.ok('rows' in r);
Please sign in to comment.
Something went wrong with that request. Please try again.