summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2011-01-21 14:05:07 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2011-01-21 14:05:07 +0000
commit9ce71f36273bad1f48d0b117799ad8d682451258 (patch)
tree2b84976aa8a5d94c04eae8671c6e1e4ad924c94c /share/www
parent4aaadc75abce9a6d662b807df92989505cba4a49 (diff)
Merged revision 1061809 from trunk
Fix strange result when passing a filter and a limit of 1 to /db/_changes Fixes COUCHDB-1037 git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1061811 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/test/changes.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js
index 7ce3baaa..5998f48c 100644
--- a/share/www/script/test/changes.js
+++ b/share/www/script/test/changes.js
@@ -461,5 +461,49 @@ couchTests.changes = function(debug) {
});
+ // COUCHDB-1037 - empty result for ?limit=1&filter=foo/bar in some cases
+ T(db.deleteDb());
+ T(db.createDb());
+
+ ddoc = {
+ _id: "_design/testdocs",
+ filters: {
+ testdocsonly: (function(doc, req) {
+ return (typeof doc.integer === "number");
+ }).toString()
+ }
+ };
+ T(db.save(ddoc));
+
+ ddoc = {
+ _id: "_design/foobar",
+ foo: "bar"
+ };
+ T(db.save(ddoc));
+
+ db.bulkSave(makeDocs(0, 5));
+
+ req = CouchDB.request("GET", "/" + db.name + "/_changes");
+ resp = JSON.parse(req.responseText);
+ TEquals(7, resp.last_seq);
+ TEquals(7, resp.results.length);
+
+ req = CouchDB.request(
+ "GET", "/"+ db.name + "/_changes?limit=1&filter=testdocs/testdocsonly");
+ resp = JSON.parse(req.responseText);
+ TEquals(3, resp.last_seq);
+ TEquals(1, resp.results.length);
+ TEquals("0", resp.results[0].id);
+
+ req = CouchDB.request(
+ "GET", "/" + db.name + "/_changes?limit=2&filter=testdocs/testdocsonly");
+ resp = JSON.parse(req.responseText);
+ TEquals(4, resp.last_seq);
+ TEquals(2, resp.results.length);
+ TEquals("0", resp.results[0].id);
+ TEquals("1", resp.results[1].id);
+
+ // cleanup
+ db.deleteDb();
};