db.view returning undefined doc object #213

Closed
Kielan opened this Issue Jun 29, 2014 · 4 comments

Comments

Projects
None yet
3 participants

Kielan commented Jun 29, 2014

Note: I am updating this issue as I've looked deeper into the problem, I would love to get as much feedback as possible from somebody familiar with this codebase in order to fix this, as I'm pretty sure I have found a bug.

I made a stackoverflow question with my problem here.

http://stackoverflow.com/questions/24470317/couchdb-nano-ejs-template-cannot-call-foreach-undefined?noredirect=1#comment37877182_24470317

and the only reply was a comment pointing to this question and stating it might be a problem with nano

http://stackoverflow.com/questions/24426757/how-to-get-documents-from-couchdb-database-in-node-js/

doc should not be undefined according to the nano.js docs, I'm pretty sure about this. I believe that I have tracked the problem down to nano at line 850:

function view_docs(design_name,view_name,params,callback)

possibly to do with the use of relax in the return part of the function. I am looking further into this object and comparing next to the couchDB API to track down the issue, again any feedback is appreciated as it will speed me up.

Kielan commented Jul 4, 2014

Looking into this I have found that when I use an emit function in my view that is a single value object I get the correct key value pair. However using a value parameter of an object such as {'title': doc.title, 'date': doc.date, 'tags': doc.tags} as opposed to simply a 'doc' object; when I console.log(doc) my value returned is [Object] which looked like some kind of uncaught snag.

I tried accessing inside of the [Object] value and it does not have the values that the return object should have.

Its pretty cryptic though and I could not find anywhere in the couchdb error so from what I've gathered this should probably be handled by the nano driver, and more specifically the relax function .
couchdb problem

Contributor

streunerlein commented Oct 11, 2014

Hi Kielan

i know this issue is old and dusty, but can you provide some more information? Your stackoverflow questions is not reachable from here.
e.g. It would be interesting what exactly you were trying to do and what failed, and a sample document and the full source of your basicmap view.

As for now i am not convinced, that this is a nano issue - but if it is, i really wanna know about it. So if you could come back and comment further, also in case you solved the problem by yourself already, i would be very happy.

Greetings

Dominique

dscape closed this Oct 13, 2014

Owner

dscape commented Oct 13, 2014

@streunerlein thanks for the input. Will reopen when @streunerlein requests are met.

Kielan commented Oct 16, 2014

Hi dominique I will get to this as soon as I can. I've been on a series of
tight deadlines though. s soon as I get a chance I will do a full write up
of the issue. I think that I did make a mistake somewhere, but when I
talked to a guy familiar with CouchDB he looked at it for a while and was
having trouble as well. I read through nano and thoroughly and I think it
has something to do with me misusing request in a way that nano seemed to
support but actually does not.

On Mon, Oct 13, 2014 at 8:10 PM, Nuno Job notifications@github.com wrote:

@streunerlein https://github.com/streunerlein thanks for the input.
Will reopen when @streunerlein https://github.com/streunerlein requests
are met.


Reply to this email directly or view it on GitHub
#213 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment