Hi!
New to web developing in general, couchdb in specific.
Right now I try to understand how to call views. I have fairly simple documents generated and submitted to the my database through an app based on Simplest possible form found on Kan.so and I try out different views in Futon. All well. Then I try to create a view in the design-document and call from within the code. To no avail.
Even such a simple view as the following delivers correct in a temporary view:
function(doc) {
if (doc.type == 'person') {
emit(doc._id, doc);
}
};
But put into the lib/views.js
-file like this (only exports.map_type =
added):
exports.map_type = function(doc) {
if (doc.type == 'person') {
emit(doc._id, doc);
}
};
wont work when called even from the address-field in the browser like this:
http://localhost:5984/simplestpossibleform/_design/my_form/_view/map_type
and results as follows:
{"error":"unknown_error","reason":"function_clause"}
So, something is wrong in the function clause. Well, I cannot see it. The code is copy-pasted from Futons temporary view. And when I try the view from the dropdown it faults while doing a cut and paste from the design doc to the temporary view in Futon works perfect. Maybe there is something else wrong, just can't figure it out.
Can anyone, please, help me?
(Running on couchdb 1.2, Kanso 0.3.1)