summaryrefslogtreecommitdiff
path: root/src/fabric_rpc.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-02 12:07:30 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-06-02 12:07:30 -0400
commit0340953f4ff3cc6ee09b786031442f97f79090c3 (patch)
treee6b87a407b634f6619bf640e5515cc0e744330a4 /src/fabric_rpc.erl
parentb12bcd244bdf743de8c91808cf03417b1ea9dde2 (diff)
_all_docs with keys, closes BugzID 10218
Diffstat (limited to 'src/fabric_rpc.erl')
-rw-r--r--src/fabric_rpc.erl22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index 1cae5ac5..c6aef20b 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -127,21 +127,17 @@ view_fold({{Key,Id}, Value}, _Offset, Acc) ->
true ->
{stop, Acc};
false ->
- Row = case IncludeDocs of
- true ->
+ Doc = if not IncludeDocs -> undefined; true ->
case couch_db:open_doc(Db, Id, []) of
- {not_found, missing} ->
- #view_row{key=Key, id=Id, value=Value, doc={error,missing}};
- {not_found, deleted} ->
- #view_row{key=Key, id=Id, value=Value};
- {ok, Doc} ->
- JsonDoc = couch_doc:to_json_obj(Doc, []),
- #view_row{key=Key, id=Id, value=Value, doc=JsonDoc}
- end;
- false ->
- #view_row{key=Key, id=Id, value=Value}
+ {not_found, deleted} ->
+ null;
+ {not_found, missing} ->
+ undefined;
+ {ok, Doc0} ->
+ couch_doc:to_json_obj(Doc0, [])
+ end
end,
- rexi:sync_reply(Row),
+ rexi:sync_reply(#view_row{key=Key, id=Id, value=Value, doc=Doc}),
{ok, Acc#view_acc{limit=Limit-1}}
end.