summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Avdey <eiri@eiri.ca>2017-03-17 11:04:53 -0300
committerJay Doane <jay.s.doane@gmail.com>2017-04-24 11:53:57 -0700
commit2bc93b9a8c3c786a131c555a79e253b00f3e05f9 (patch)
tree3d6fccbec2a5afac96f776d25a3efaa66b47ce85
parent4aba3bc5c0b48e7902ebd1ae3c5f379e0ea9ac66 (diff)
downloadcouchdb-2bc93b9a8c3c786a131c555a79e253b00f3e05f9.tar.gz
Make _local_docs conform to include_docs
-rw-r--r--src/couch_mrview/src/couch_mrview.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/couch_mrview/src/couch_mrview.erl b/src/couch_mrview/src/couch_mrview.erl
index 088327c45..c85216d85 100644
--- a/src/couch_mrview/src/couch_mrview.erl
+++ b/src/couch_mrview/src/couch_mrview.erl
@@ -533,15 +533,17 @@ map_fold({{Key, Id}, Val}, _Offset, Acc) ->
user_acc=UAcc1,
last_go=Go
}};
-map_fold({<<"_local/",_/binary>> = DocId, {Rev0, _Body}}, _Offset, #mracc{} = Acc) ->
+map_fold({<<"_local/",_/binary>> = DocId, {Rev0, Body}}, _Offset, #mracc{} = Acc) ->
#mracc{
limit=Limit,
callback=Callback,
- user_acc=UAcc0
+ user_acc=UAcc0,
+ args=Args
} = Acc,
Rev = {0, list_to_binary(integer_to_list(Rev0))},
Value = {[{rev, couch_doc:rev_to_str(Rev)}]},
- Row = [{id, DocId}, {key, DocId}, {value, Value}],
+ Doc = if Args#mrargs.include_docs -> [{doc, Body}]; true -> [] end,
+ Row = [{id, DocId}, {key, DocId}, {value, Value}] ++ Doc,
{Go, UAcc1} = Callback({row, Row}, UAcc0),
{Go, Acc#mracc{
limit=Limit-1,