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

Merged
merged 2 commits into from Feb 1, 2012

2 participants

@jnisenson

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);}"
}

@janmonschke
Owner

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

@jnisenson

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

@janmonschke
Owner

That was quick :) Thx!

@janmonschke janmonschke merged commit de45b6b into janmonschke:master Feb 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment