You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2008/10/21 21:49:42 UTC

svn commit: r706735 - in /incubator/couchdb/trunk: share/www/script/couch_tests.js src/couchdb/couch_httpd_view.erl

Author: jchris
Date: Tue Oct 21 12:49:41 2008
New Revision: 706735

URL: http://svn.apache.org/viewvc?rev=706735&view=rev
Log:
fix for COUCHDB-138 include_docs=true&reduce=false

Modified:
    incubator/couchdb/trunk/share/www/script/couch_tests.js
    incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl

Modified: incubator/couchdb/trunk/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/script/couch_tests.js?rev=706735&r1=706734&r2=706735&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] Tue Oct 21 12:49:41 2008
@@ -1172,6 +1172,10 @@
         T(e.error == 'query_parse_error');
     }
 
+    // Reduce support when reduce=false
+    resp = db.view('test/summate', {reduce: false, include_docs: true});
+    T(resp.rows.length == 100);
+
     // Check emitted _rev controls things
     resp = db.allDocs({include_docs: true}, ["0"]);
     var before = resp.rows[0].doc;

Modified: incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=706735&r1=706734&r2=706735&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl Tue Oct 21 12:49:41 2008
@@ -308,8 +308,14 @@
         {"include_docs", Value} ->
             case IsReduce of
             true ->
-                Msg = lists:flatten(io_lib:format("Bad URL query key for reduce operation: ~s", [Key])),
-                throw({query_parse_error, Msg});
+                #view_query_args{reduce=OptReduce} = Args,
+                case OptReduce of
+                    true ->
+                        Msg = lists:flatten(io_lib:format("Bad URL query key for reduce operation: ~s", [Key])),
+                        throw({query_parse_error, Msg});
+                _ ->
+                    ok
+                end;
             _ ->
                 ok
             end,