couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Magnus Ottosson <mag...@magnusottosson.se>
Subject Re: Search for city by name, order by population
Date Mon, 12 Apr 2010 09:19:20 GMT
Are you sure about that?

Wouldn't [name, population] first order the cities by name and if
there are more than one city with the same name they would be order by
population?

Magnus



On Mon, Apr 12, 2010 at 10:59 AM, Nils Breunese <N.Breunese@vpro.nl> wrote:
> If you use [name, population] as the key I believe you'll get what you need. You could
query the view like this: ?startkey=["name"]&endkey=["name",{}]
>
> Also check out the article on view collation on the wiki: http://wiki.apache.org/couchdb/View_collation
>
> Nils Breunese.
> ________________________________________
> Van: Magnus Ottosson [magnus@magnusottosson.se]
> Verzonden: maandag 12 april 2010 10:25
> Aan: user@couchdb.apache.org
> Onderwerp: Search for city by name, order by population
>
> Hi,
>
> I have a database with the names and population of cities (about 7
> million entities). Is it possible, with couchdb, to create a key that
> includes both cityname and population where I can search for a name
> and get the matching results ordered by the population?
>
> I tried to create a key like [population, name] and search like this
> ?startkey=[0, "name"]&endkey=[10000000, "name]&limit=10 but it does
> not work like the way I hoped.
>
> Any ideas?
>
> Magnus
>
> De informatie vervat in deze  e-mail en meegezonden bijlagen is uitsluitend bedoeld
voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking,
vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden
aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud
van een verzonden e-mail, noch voor tijdige ontvangst daarvan.
>

Mime
View raw message