incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Barnes <mrtr...@gmail.com>
Subject Re: Sorting padded numbers?
Date Wed, 17 Mar 2010 11:24:25 GMT
Luis - if you emit them as numbers rather than strings, they will sort in
the proper order.

>From memory, I think one of the string methods is used to convert string to
int.

Alternatively, consider storing those properties as numbers in the first
place - not only will your keys sort properly, but it will probably use less
space per doc and build views faster.

HTH,
-Patrick

On 17/03/2010 10:05 PM, "Luis Gomez" <lgomez@gmail.com> wrote:

Hi, quick one this time...

How can I make a map function sort these keys numerically? Is there an
easy/conventional way or do I need to pad the numbers?

1
10
11
12
13
14
15
16
17
18
19
2
20
21
22
23
24
25
26
27
28
29
3
30
31
32
33
34
35
36
37
38
39
...

Thanks,

Luis

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message