You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2009/04/25 20:29:16 UTC

svn commit: r768573 - in /couchdb/trunk: share/www/script/test/view_include_docs.js src/couchdb/couch_httpd_view.erl

Author: davisp
Date: Sat Apr 25 18:29:15 2009
New Revision: 768573

URL: http://svn.apache.org/viewvc?rev=768573&view=rev
Log:
Resolves COUCHDB-331 - Allow reduce=true&include_docs=false


Modified:
    couchdb/trunk/share/www/script/test/view_include_docs.js
    couchdb/trunk/src/couchdb/couch_httpd_view.erl

Modified: couchdb/trunk/share/www/script/test/view_include_docs.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/view_include_docs.js?rev=768573&r1=768572&r2=768573&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/view_include_docs.js (original)
+++ couchdb/trunk/share/www/script/test/view_include_docs.js Sat Apr 25 18:29:15 2009
@@ -79,6 +79,11 @@
   resp = db.view('test/summate', {reduce: false, include_docs: true});
   T(resp.rows.length == 100);
 
+  // Not an error with include_docs=false&reduce=true
+  resp = db.view('test/summate', {reduce: true, include_docs: false});
+  T(resp.rows.length == 1);
+  T(resp.rows[0].value == 4950);
+
   // Check emitted _rev controls things
   resp = db.allDocs({include_docs: true}, ["0"]);
   var before = resp.rows[0].doc;

Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=768573&r1=768572&r2=768573&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Sat Apr 25 18:29:15 2009
@@ -409,7 +409,7 @@
         _ ->
             Args
     end;
-validate_view_query(include_docs, _Value, Args) ->
+validate_view_query(include_docs, true, Args) ->
     case Args#view_query_args.view_type of
         reduce ->
             Msg = <<"Query paramter `include_docs` "
@@ -418,6 +418,8 @@
         _ ->
             Args#view_query_args{include_docs=true}
     end;
+validate_view_query(include_docs, _Value, Args) ->
+    Args;
 validate_view_query(extra, {Key, _}, Args) ->
     case Args#view_query_args.ignore of
         strict ->