couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filipe David Manana <>
Subject Re: [VOTE] Apache CouchDB 1.2.0 release, first round
Date Mon, 13 Feb 2012 15:46:17 GMT
On Mon, Feb 13, 2012 at 10:55 AM, Randall Leeds <> wrote:
> A very rigorous approach might be to work with the tokenized, but not
> decoded, JSON so that numeric field values could be passed verbatim. For
> 1.2 I'd just like to see the integer regression patched.

Catching up on this thread, that seems to be what I had in mind as well.
The following simple patch would do it:

For every JSON document coming from the http interface, it doesn't
decode numbers, only validates them, and have them represented by the
term {json, RawJsonNumberIoList}  (this term is something already used
by mochijson2, but not by ejson before).

For JSON coming from the view server, like the 1 coming from a
validate_doc_update request, we would keep doing as we do now, except
for map/reduce values where we would use the approach mentioned above.

The above patch is just a quick experiment, I didn't attempt to verify
all possible scenarios. Only verified that the test suite passes.

With the patch:

$ curl -X PUT http://localhost:5984/test/doc1 -d '{"_id": "doc1",
"integer": 1, "float": 1.0}'

$ curl http://localhost:5984/test/doc1

Without (current behaviour):

$ curl -X PUT http://localhost:5984/test/doc1 -d '{"_id": "doc1",
"integer": 1, "float": 1.0}'

$ curl http://localhost:5984/test/doc1

Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

View raw message