diff options
-rw-r--r-- | share/www/script/test/all_docs.js | 7 | ||||
-rw-r--r-- | src/couchdb/couch_httpd_db.erl | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/share/www/script/test/all_docs.js b/share/www/script/test/all_docs.js index 910d4462..4324e3bb 100644 --- a/share/www/script/test/all_docs.js +++ b/share/www/script/test/all_docs.js @@ -86,6 +86,13 @@ couchTests.all_docs = function(debug) { T(changes.results[2].doc); T(changes.results[2].doc._deleted); + rows = db.allDocs({include_docs: true}, ["1"]).rows; + TEquals(1, rows.length); + TEquals("1", rows[0].key); + TEquals("1", rows[0].id); + TEquals(true, rows[0].value.deleted); + TEquals(null, rows[0].doc); + // add conflicts var conflictDoc1 = { _id: "3", _rev: "2-aa01552213fafa022e6167113ed01087", value: "X" diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index 9aa91277..82e9b989 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -559,7 +559,12 @@ all_docs_send_json_view_row(Resp, Db, KV, IncludeDocs, RowFront) -> all_docs_view_row_obj(_Db, {{DocId, error}, Value}, _IncludeDocs) -> {[{key, DocId}, {error, Value}]}; all_docs_view_row_obj(Db, {_KeyDocId, DocInfo}, true) -> - {all_docs_row(DocInfo) ++ couch_httpd_view:doc_member(Db, DocInfo)}; + case DocInfo of + #doc_info{revs = [#rev_info{deleted = true} | _]} -> + {all_docs_row(DocInfo) ++ [{doc, null}]}; + _ -> + {all_docs_row(DocInfo) ++ couch_httpd_view:doc_member(Db, DocInfo)} + end; all_docs_view_row_obj(_Db, {_KeyDocId, DocInfo}, _IncludeDocs) -> {all_docs_row(DocInfo)}. |