couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jehan Bihin <squellett...@gmail.com>
Subject Re: View to find someone in a list in a document
Date Wed, 02 Sep 2009 17:55:07 GMT
Thanks a lot ! I'll try it.


2009/9/2 Simon Metson <simonmetson@googlemail.com>

> Ok, so use that map function and query it as:
>
> http://localhost:5984/test/_design/users/_view/user?key=<user_name>
>
> That will give you back all the documents that have <user_name> in the
> users list.
> Cheers
> Simon
>
>
>
> On 2 Sep 2009, at 18:12, Jehan Bihin wrote:
>
>  Hi Simon,
>>
>> Thanks for your help.
>>
>> I need the document if the key is present in the list.
>>
>> Thanks,
>>
>> Jehan
>>
>>
>> 2009/9/2 Simon Metson <simonmetson@googlemail.com>
>>
>>  Hi,
>>>      Do you mean you want to emit each user as a key? Something like:
>>>
>>> function(doc) { for (v in doc.users) { emit(doc.users[v], doc); }
>>>
>>> as a map would do that.
>>> Cheers
>>> Simon
>>>
>>>
>>> On 2 Sep 2009, at 17:25, Jehan Bihin wrote:
>>>
>>> Hi all,
>>>
>>>>
>>>> (sorry for my english)
>>>> I have a document having a list of persons :
>>>>
>>>> ...
>>>> "users":{"membre-joouul_hotmail.com":["createur"],"membre-
>>>> killan_daaboo.net
>>>> ":["moderateur"]}
>>>> ...
>>>>
>>>> Each persons have some roles.
>>>> My key is the membre like 'membre-joouul_hotmail.com'
>>>> And i want to list all document having my key present in the users list.
>>>>
>>>> Is it possible and correct to have it ?
>>>> Can you guide me ? After reading here and the site I found nothing
>>>> talking
>>>> on that.
>>>>
>>>> Thanks in advance,
>>>>
>>>> Jehan
>>>>
>>>>
>>>
>>>
>

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