summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_changes.erl
diff options
context:
space:
mode:
authorBenoit Chesneau <benoitc@apache.org>2010-10-13 21:02:46 +0000
committerBenoit Chesneau <benoitc@apache.org>2010-10-13 21:02:46 +0000
commit3072bbc46e4d9e0bc2938776c965a5d2e6a15881 (patch)
tree178cdaa80262b96d47ae562696412369befd08c6 /src/couchdb/couch_changes.erl
parentc15fe1593ab99b439d2dfc187e6d0b0e20b985a8 (diff)
get _changes on specific docids
/POST /db/_changes {"doc_ids": ["docid1", ...]} git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1022291 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_changes.erl')
-rw-r--r--src/couchdb/couch_changes.erl15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl
index dd884cad..6fc4597a 100644
--- a/src/couchdb/couch_changes.erl
+++ b/src/couchdb/couch_changes.erl
@@ -78,6 +78,21 @@ get_callback_acc(Callback) when is_function(Callback, 2) ->
{fun(Ev, Data, _) -> Callback(Ev, Data) end, ok}.
%% @type Req -> #httpd{} | {json_req, JsonObj()}
+make_filter_fun({docids, Docids}, Style, _Req, _Db) ->
+ fun(#doc_info{id=DocId, revs=[#rev_info{rev=Rev}|_]=Revs}) ->
+ case lists:member(DocId, Docids) of
+ true ->
+ case Style of
+ main_only ->
+ [{[{<<"rev">>, couch_doc:rev_to_str(Rev)}]}];
+ all_docs ->
+ [{[{<<"rev">>, couch_doc:rev_to_str(R)}]}
+ || #rev_info{rev=R} <- Revs]
+ end;
+ _ -> []
+ end
+ end;
+
make_filter_fun(FilterName, Style, Req, Db) ->
case [list_to_binary(couch_httpd:unquote(Part))
|| Part <- string:tokens(FilterName, "/")] of