couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duane Almond Sto. Tomas" <dua...@gmail.com>
Subject problem with two key ranges in couchdb
Date Sat, 02 Jan 2010 13:41:49 GMT
I'm having problem getting the right results in my coordinate system.
To explain my system, I have this simple database that have x_axis, y_axis
and name columns. I don't need to get all the data, I just need to display
some part of it.

For example, I have a coordinate system that have 10:10(meaning from x_axis
-10 to 10 and from y_axis -10 to 10) and I want to display only 49
coordinates. In sql query I can do it something like this:
"select * from coordinate where x_axis >= -3 and x_axis <= 3 and y_axis >=
-3 y_axis <= 3"

I tried this function but no success:

       "by_range": {
           "map": "function(doc) { emit([doc.x_axis, doc.y_axis], doc) }"
       }

by_range?startkey=[-3,-3]&endkey=[3,3]

I got a wrong results of:

-3x-3
-3x-2
-3x-1
-3x0
-3x1
-3x2
-3x3
<-- should not display this part -->
-3x4
-3x5
-3x6
-3x7
-3x8
-3x9
-3x10
<-- end of should not display this part -->
..... up to 3x3

to give you a better understanding of my project here is the screenshot of
that I want to be made:
http://img96.imageshack.us/img96/5382/coordinates.jpg

-- 
I wanted a perfect ending.
Now I've learned, the hard way, that some poems don't rhyme, and some
stories don't have a clear beginning, middle, and end.
Life is about not knowing, having to change, taking the moment and making
the best of it, without knowing what's going to happen next......Farewell
Team !

Duane Almond C. Sto. Tomas
09062772487
OOiP Manila
personal websites:
   http://duasto.freehostia.com/
   http://duanealmond.com/

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