You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Jan Lehnardt (JIRA)" <ji...@apache.org> on 2015/07/02 10:54:04 UTC

[jira] [Commented] (COUCHDB-2739) emit doc._id, doc with include_docs=true results in row.value != row.doc

    [ https://issues.apache.org/jira/browse/COUCHDB-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14611675#comment-14611675 ] 

Jan Lehnardt commented on COUCHDB-2739:
---------------------------------------

Yeah, this is the same as COUCHDB_1407: The JavaScript that evaluates the map function treats numbers differently than the Erlang that satisfies the include_docs=true.

I don’t think we can do much about this.

> emit doc._id, doc with include_docs=true results in row.value != row.doc
> ------------------------------------------------------------------------
>
>                 Key: COUCHDB-2739
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2739
>             Project: CouchDB
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: JavaScript View Server
>            Reporter: Eli Stevens
>
> I would expect that "value" and "doc" would have the exact same representation. Instead, the view value is being coerced to an integer.
> elis@build6:~/edit/dev$ export H='Content-Type: application/json'
> elis@build6:~/edit/dev$ curl -H "$H" -X PUT http://localhost:5984/bugdemo
> {"ok":true}
> elis@build6:~/edit/dev$ curl -H "$H" -X POST http://localhost:5984/bugdemo -d '{"_id":"_design/float","language":"coffeescript","views":{"toint":{"map":"(doc) -> emit doc._id, doc"}}}'
> {"ok":true,"id":"_design/float","rev":"1-90ef6c0eb7711d000cf3f40448cc5f42"}
> elis@build6:~/edit/dev$ curl -H "$H" -X POST http://localhost:5984/bugdemo -d '{"v":1.0}'
> {"ok":true,"id":"4e...f6","rev":"1-2d...cc"}
> elis@build6:~/edit/dev$ curl -H "$H" -X GET http://localhost:5984/bugdemo/_design/float/_view/toint?include_docs=true
> {"total_rows":1,"offset":0,"rows":[{"id":"4e...f6","key":"4e...f6",
> "value":
>     {"_id":"4e...f6","_rev":"1-2d...cc","v":1},
> "doc":
>     {"_id":"4e...f6","_rev":"1-2d...cc","v":1.0}}
> ]}
> Note the "v":1 vs. "v":1.0 .
> AFAICT, this happens for all values that pass through a view, not just emit xxx, doc cases (but I think that this is a clear example of why the current behavior is incorrect).
> This seems related to https://issues.apache.org/jira/browse/COUCHDB-1407 but I'm not sure if the root cause is similar.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)