Add support for multi-document-fetch (via _all_docs) to jquery.couch.js.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@949037 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/jquery.couch.js b/jquery.couch.js
index 99d97f5..4ce7549 100644
--- a/jquery.couch.js
+++ b/jquery.couch.js
@@ -231,8 +231,19 @@
);
},
allDocs: function(options) {
- ajax(
- {url: this.uri + "_all_docs" + encodeOptions(options)},
+ var type = "GET";
+ var data = null;
+ if (options["keys"]) {
+ type = "POST";
+ var keys = options["keys"];
+ delete options["keys"];
+ data = toJSON({ "keys": keys });
+ }
+ ajax({
+ type: type,
+ data: data,
+ url: this.uri + "_all_docs" + encodeOptions(options)
+ },
options,
"An error occurred retrieving a list of all documents"
);