summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_httpd_db.erl2
-rw-r--r--src/couchdb/couch_httpd_view.erl13
2 files changed, 8 insertions, 7 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 03093c41..cdc74610 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -192,7 +192,7 @@ changes_enumerator(DocInfos, {Db, _, Prepend, FilterFun, Resp, _, Limit, Include
changes_row(Db, Seq, Id, Del, Results, Rev, true) ->
{[{seq,Seq},{id,Id},{changes,Results}] ++ deleted_item(Del) ++
- couch_httpd_view:doc_member(Db, Id, Rev)};
+ couch_httpd_view:doc_member(Db, {Id, Rev})};
changes_row(_, Seq, Id, Del, Results, _, false) ->
{[{seq,Seq},{id,Id},{changes,Results}] ++ deleted_item(Del)}.
diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl
index 531e3b6c..489df0a2 100644
--- a/src/couchdb/couch_httpd_view.erl
+++ b/src/couchdb/couch_httpd_view.erl
@@ -18,7 +18,7 @@
-export([get_stale_type/1, get_reduce_type/1, parse_view_params/3]).
-export([make_view_fold_fun/6, finish_view_fold/4, view_row_obj/3]).
-export([view_group_etag/2, view_group_etag/3, make_reduce_fold_funs/5]).
--export([design_doc_view/5, parse_bool_param/1, doc_member/3]).
+-export([design_doc_view/5, parse_bool_param/1, doc_member/2]).
-export([make_key_options/1]).
-import(couch_httpd,
@@ -589,17 +589,18 @@ view_row_obj(Db, {{Key, DocId}, {Props}}, true) ->
Rev0 ->
couch_doc:parse_rev(Rev0)
end,
- view_row_with_doc(Db, {{Key, DocId}, {Props}}, Rev);
+ IncludeId = proplists:get_value(<<"_id">>, Props, DocId),
+ view_row_with_doc(Db, {{Key, DocId}, {Props}}, {IncludeId, Rev});
view_row_obj(Db, {{Key, DocId}, Value}, true) ->
- view_row_with_doc(Db, {{Key, DocId}, Value}, nil);
+ view_row_with_doc(Db, {{Key, DocId}, Value}, {DocId, nil});
% the normal case for rendering a view row
view_row_obj(_Db, {{Key, DocId}, Value}, _IncludeDocs) ->
{[{id, DocId}, {key, Key}, {value, Value}]}.
-view_row_with_doc(Db, {{Key, DocId}, Value}, Rev) ->
- {[{id, DocId}, {key, Key}, {value, Value}] ++ doc_member(Db, DocId, Rev)}.
+view_row_with_doc(Db, {{Key, DocId}, Value}, IdRev) ->
+ {[{id, DocId}, {key, Key}, {value, Value}] ++ doc_member(Db, IdRev)}.
-doc_member(Db, DocId, Rev) ->
+doc_member(Db, {DocId, Rev}) ->
?LOG_DEBUG("Include Doc: ~p ~p", [DocId, Rev]),
case (catch couch_httpd_db:couch_doc_open(Db, DocId, Rev, [])) of
#doc{} = Doc ->