couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r670774 - in /incubator/couchdb/trunk: share/www/script/couch_tests.js src/couchdb/couch_httpd.erl
Date Mon, 23 Jun 2008 21:32:58 GMT
Author: cmlenz
Date: Mon Jun 23 14:32:58 2008
New Revision: 670774

URL: http://svn.apache.org/viewvc?rev=670774&view=rev
Log:
Apply patch by Chris Anderson that fixes an edge case in the HTTP view interface resulting
in an invalid JSON response body. Closes COUCHDB-84.

Modified:
    incubator/couchdb/trunk/share/www/script/couch_tests.js
    incubator/couchdb/trunk/src/couchdb/couch_httpd.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=670774&r1=670773&r2=670774&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] Mon Jun 23 14:32:58 2008
@@ -328,7 +328,12 @@
       T(equals(results.rows[1], {key:["a","b"],value:20*i}));
       T(equals(results.rows[2], {key:["a", "b", "c"],value:10*i}));
       T(equals(results.rows[3], {key:["a", "b", "d"],value:10*i}));
-      
+
+      // test to make sure group reduce and count params provide valid json
+      var results = db.query(map, reduce, {group: true, count: 2});
+      T(equals(results.rows[0], {key: ["a"], value: 20*i}));
+      T(equals(results.rows.length, 2));
+
       //group by the first element in the key array
       var results = db.query(map, reduce, {group_level:1});
       T(equals(results.rows[0], {key:["a"],value:70*i}));
@@ -1146,7 +1151,7 @@
     db.deleteDb();
     db.createDb();
     if (debug) debugger;
-    var docs = makeDocs(0, 25);
+    var docs = makeDocs(0, 10);
     var saveResult = db.bulkSave(docs);
     T(saveResult.ok);
 

Modified: incubator/couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=670774&r1=670773&r2=670774&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_httpd.erl Mon Jun 23 14:32:58 2008
@@ -463,7 +463,7 @@
         fun(_Key, _Red, {AccSeparator,AccSkip,AccCount}) when AccSkip > 0 ->
             {ok, {AccSeparator,AccSkip-1,AccCount}};
         (_Key, _Red, {AccSeparator,0,AccCount}) when AccCount == 0 ->
-            {stop,{AccSeparator,0,AccCount}};
+            {ok, {AccSeparator,0,AccCount}};
         (_Key, Red, {AccSeparator,0,AccCount}) when GroupLevel == 0 ->
             Json = lists:flatten(cjson:encode({obj, [{key, null}, {value, Red}]})),
             Resp:write_chunk(AccSeparator ++ Json),



Mime
View raw message