Hi, Just a quick check (since I am not entirely familiar with this). Does this also imply that the couchdb 'on disk' format needs a version increase? (since the term representing numeric fields changes?)
Best regards, Jeroen Janssen On Mon, Feb 13, 2012 at 4:46 PM, Filipe David Manana <[email protected]> wrote: > On Mon, Feb 13, 2012 at 10:55 AM, Randall Leeds <[email protected]> > 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: > > http://friendpaste.com/1H4zOcciVjajGuYTRyrUUB > > 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}' > {"ok":true,"id":"doc1","rev":"1-67bc2600ba5ce41db1961e410f79a611"} > > $ curl http://localhost:5984/test/doc1 > {"_id":"doc1","_rev":"1-67bc2600ba5ce41db1961e410f79a611","integer":1,"float":1.0} > > Without (current behaviour): > > $ curl -X PUT http://localhost:5984/test/doc1 -d '{"_id": "doc1", > "integer": 1, "float": 1.0}' > {"ok":true,"id":"doc1","rev":"1-308b01bbabea74f0cea2af7d0e270fb8"} > > $ curl http://localhost:5984/test/doc1 > {"_id":"doc1","_rev":"1-308b01bbabea74f0cea2af7d0e270fb8","integer":1,"float":1} > > > > -- > 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."
