couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tito Ciuro <tci...@mac.com>
Subject Re: Matching docs which values ending with a specific string
Date Thu, 13 Feb 2014 01:15:38 GMT
Cool! Definitely works for me.

Thanks everyone for the help,

-- Tito

On Feb 12, 2014, at 3:20 PM, Robert Samuel Newson <rnewson@apache.org> wrote:

> Tito,
> 
> You’re missing the point. You can’t select by the second element of the array for
the same reason you can’t select by the second half of your original string. :)
> 
> Benoit’s suggestion to do both is good, as long as you don’t care to know whether
you’ve found a town or a city. If you do, then;
> 
> emit(["town_city", doc.town, doc.city], null);
> emit(["city_town", doc.city, doc.town], null);
> 
> (or two separate views).
> 
> B.
> 
> On 12 Feb 2014, at 23:17, Benoit Chesneau <bchesneau@gmail.com> wrote:
> 
>> On Wed, Feb 12, 2014 at 11:35 PM, Tito Ciuro <tciuro@mac.com> wrote:
>>> Hello,
>>> 
>>> I have a database with documents with the following format:
>>> 
>>> {
>>>   "_id" : "12345",
>>>   "location" : <some_city>.<some town>
>>> }
>>> 
>> 
>> you can emit[<some_city>,<some town>] *and* [<some town>, <some_city>]
>> so you can query either by city or town.
>> 
>> 
>> - benoit
> 


Mime
View raw message