Cool! Definitely works for me.

Thanks everyone for the help,

-- Tito

On Feb 12, 2014, at 3:20 PM, Robert Samuel Newson <[email protected]> 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 <[email protected]> wrote:
> 
>> On Wed, Feb 12, 2014 at 11:35 PM, Tito Ciuro <[email protected]> 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
> 

Reply via email to