diff options
author | Benoit Chesneau <benoitc@apache.org> | 2010-11-13 22:08:25 +0000 |
---|---|---|
committer | Benoit Chesneau <benoitc@apache.org> | 2010-11-13 22:08:25 +0000 |
commit | ed4f41ae7377345cd0c5cd8421d2bbf77b88a94c (patch) | |
tree | ee6a162d0a3af553b5cb33edda33ad180f6f1df6 /share/www/script/test | |
parent | 0fdfbaedfa757f4f5f3fdf550c6ded9d5a46c464 (diff) |
builtin changes filters fonctions: _doc_ids & _design. replace last
patch to get filtering on docids.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1034891 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test')
-rw-r--r-- | share/www/script/test/changes.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js index 877d1fcc..7ce3baaa 100644 --- a/share/www/script/test/changes.js +++ b/share/www/script/test/changes.js @@ -407,28 +407,40 @@ couchTests.changes = function(debug) { body: JSON.stringify({"doc_ids": ["something", "anotherthing", "andmore"]}) }; - var req = CouchDB.request("POST", "/test_suite_db/_changes", options); + var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); var resp = JSON.parse(req.responseText); T(resp.results.length === 0); T(db.save({"_id":"something", "bop" : "plankton"}).ok); - var req = CouchDB.request("POST", "/test_suite_db/_changes", options); + var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); var resp = JSON.parse(req.responseText); T(resp.results.length === 1); T(resp.results[0].id === "something"); T(db.save({"_id":"anotherthing", "bop" : "plankton"}).ok); - var req = CouchDB.request("POST", "/test_suite_db/_changes", options); + var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); var resp = JSON.parse(req.responseText); T(resp.results.length === 2); T(resp.results[0].id === "something"); T(resp.results[1].id === "anotherthing"); + + var docids = JSON.stringify(["something", "anotherthing", "andmore"]), + req = CouchDB.request("GET", "/test_suite_db/_changes?filter=_doc_ids&doc_ids="+docids, options); + var resp = JSON.parse(req.responseText); + T(resp.results.length === 2); + T(resp.results[0].id === "something"); + T(resp.results[1].id === "anotherthing"); + + var req = CouchDB.request("GET", "/test_suite_db/_changes?filter=_design"); + var resp = JSON.parse(req.responseText); + T(resp.results.length === 1); + T(resp.results[0].id === "_design/erlang"); if (!is_safari && xhr) { // filter docids with continuous xhr = CouchDB.newXhr(); - xhr.open("POST", "/test_suite_db/_changes?feed=continuous&timeout=500&since=7", true); + xhr.open("POST", "/test_suite_db/_changes?feed=continuous&timeout=500&since=7&filter=_doc_ids", true); xhr.setRequestHeader("Content-Type", "application/json"); xhr.send(options.body); |