Open GoogleCodeExporter opened 8 years ago
Can you also provide a test case?
Original comment by djc.ochtman
on 24 Dec 2009 at 9:56
As the original poster stated, reduce result rows don't have a doc id. So, I
don't
think wrapper() should ever overwrite anything in the value, i.e. it shouldn't
update
with _id=None either.
Does this version of the patch have the same effect:
if row.id:
data['_id'] = row.id
This might be better as a different ticket, but I'm not sure wrapper() should
try to
construct a schema document from the value of a reduce or view. Shouldn't a
schema view
ensure incluce_docs=True is set and then fail for reduce views (because row.doc
is
None)?
Original comment by matt.goo...@gmail.com
on 24 Dec 2009 at 11:55
I find it hard to write a test case since I don't yet understand why the
wrapper needs to set/overwrite the row
value. I see 3 cases. 1) For include_docs=True, row.doc is used instead of
doc.value, so there's no problems 2) A
full doc is included as the value (my case), and there is no need for
overwriting the id in the value 3) A partial
doc without the id is included as the value. When is this case 3 actually
needed?
Original comment by dbrat...@gmail.com
on 25 Dec 2009 at 8:26
I suppose, issue still actual?
For example we have this view map function:
function(doc){
emit(doc['_id'],1);
}
On execution, there will be an error at mapping.py@414
data = row['value']
data['_id'] = row['id'] # TypeError: 'int' object does not support item
assignment
because, row['value'] is not doc object and never will be it for all cases.
Reducing view makes another error at the same line:
KeyError: 'id' in mapping.py@414
because there is no `id` key in reduced view.
I suppose, there must not be mapping reduced view result to Document schema by
default. The only way if include_doc sets as True - this options makes us sure,
that we always will get full document, not only abstract parts of it.
Original comment by kxepal
on 27 Jun 2010 at 1:56
This issue has been migrated to GitHub. Please continue discussion here:
https://github.com/djc/couchdb-python/issues/109
Original comment by djc.ochtman
on 15 Jul 2014 at 7:17
Original issue reported on code.google.com by
dbrat...@gmail.com
on 20 Dec 2009 at 8:41Attachments: