couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Keen ...@visiture.com>
Subject Re: Strange integer anomaly in Erlang view
Date Tue, 11 May 2010 18:31:35 GMT
I guess I'm confused as to why JavaScript is ever even involved when writing views in Erlang.
Excuse my ignorance, but does all JSON go through it?

Mike

On May 11, 2010, at 12:37 PM, Jarrod Roberson wrote:

> On Tue, May 11, 2010 at 10:55 AM, Mike Keen <mk@visiture.com> wrote:
> 
>> I'd say there's a good reason to store it as a number, if I want to be able
>> to sort on that field. But, even if you could make the case that this
>> particular value should be stored as a string, shouldn't we be able to
>> expect data stored as an integer to be able to be retrieved accurately?
>> 
>> Mike
>> 
>> format the number with leading ZERO's and it will sort correctly. And no,
> read the comments on that bug report, some numbers don't convert in
> JavaScript correctly because of precision problems in SpiderMonkey. I did a
> good bit of testing with trying to store currentTimeMilliseconds from Java
> and some would not be translated by the JavaScript view engine correctly.
> The only way to be sure was to store them as strings and convert in
> non-JavaScript code.
> 
> -- 
> Jarrod Roberson


Mime
View raw message