Closed GoogleCodeExporter closed 8 years ago
The referenced line of code:
++ data = row.value
++ data['_id'] = row.id
suggests that row.value should be a dict or an object with dict-like properties.
The corresponding view docstring seems out of synch ...
>>> print Person.by_name.map_fun
function(doc) {
emit(doc.name, doc.age);
}
Elsewhere, examples show
emit(doc.name, null);
and indeed, the raw _view output correspondingly shows value=None.
I had some success using a dict as a workaround, along the lines of the
following, when defining a view:
function(doc) {
emit(doc.name, {'age':doc.age, 'name':doc.name} );
}
It's hardly a 'map back into the object' but it does avoid the Exception
condition. I haven't investigated any
deeper than that simplistic change.
Original comment by gjhigg...@gmail.com
on 3 Jan 2009 at 5:40
After a little more investigation ... the view in the OP's attached script
doesn't support the usage in the code.
If the emit function is changed to:
emit(doc.name, doc);
then the OP's attached script executes without causing an Exception and the
retrieved results do indeed
behave as User objects, e.g.
print elem.name
HTH
Original comment by gjhigg...@gmail.com
on 4 Jan 2009 at 2:16
Looks like this isn't a couchdb-python problem.
Original comment by djc.ochtman
on 8 Dec 2009 at 4:23
Original issue reported on code.google.com by
mlmiller...@gmail.com
on 29 Nov 2008 at 10:02Attachments: