Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fix for "include_docs : true" when the view emits a null value #35

merged 2 commits into from

2 participants


This fix handles the case where include_docs is true and the view emits only the key and null. When the view value is null we check to see if the doc exists in the returned data (as it will when include_docs is true)

Example for a couchapp view with a complex key:
"by_test_type_date" : {
"map": "function (doc) { emit([doc.test_type, doc.created_at], null);}"


Looks good, can you provide the CoffeeScript source as well and recompile it then?
This is the part of the CS doc for conditionals:


Here is the pull request that includes the .coffee fix as well using:

if doc.value then _temp.push doc.value else _temp.push doc.doc


That was quick :) Thx!

@janmonschke janmonschke merged commit de45b6b into janmonschke:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 31, 2012
  1. Update backbone-couchdb.js

    Josh Nisenson authored
Commits on Feb 1, 2012
  1. Update

    Josh Nisenson authored
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 3 deletions.
  1. +1 −1 
  2. +1 −2  backbone-couchdb.js
2 
@@ -65,7 +65,7 @@ Backbone.couch_connector = con =
success : (data) =>
_temp = []
for doc in data.rows
- _temp.push doc.value
+ if doc.value then _temp.push doc.value else _temp.push doc.doc
opts.success _temp
error : ->
3  backbone-couchdb.js
@@ -1,4 +1,3 @@
(c) 2011 Jan Monschke
@@ -73,7 +72,7 @@ backbone-couchdb.js is licensed under the MIT license.
_ref = data.rows;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
doc = _ref[_i];
- _temp.push(doc.value);
+ (doc.value) ? _temp.push(doc.value) : _temp.push(doc.doc);
return opts.complete();
Something went wrong with that request. Please try again.