From ed4f41ae7377345cd0c5cd8421d2bbf77b88a94c Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Sat, 13 Nov 2010 22:08:25 +0000 Subject: 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 --- share/www/script/test/changes.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'share/www/script') 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); -- cgit v1.2.3