If your dataset includes documents that may be either JSON or
binary, then you do not want to create a view that outputs
individual fields for non-JSON documents. You can fix this by
using a view that checks the metadata type
field before outputting the JSON view information:
function(doc,meta) { if (meta.type == "json") { emit(doc.firstname.toLowerCase(),null); } }
In the above example, the emit() function
will only be called on a valid JSON document. Non-JSON documents
will be ignored and not included in the view output.