couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afshin afzali <a.afzali2...@gmail.com>
Subject Re: Newbie Question about View's Startkey Match (Forked)
Date Thu, 01 Jul 2010 22:00:48 GMT
This is ok, But in real world my problem is more complicated. In my project,
there is a CONTACT document that will contains all information that somebody
may has: Name(First, Middle, Last, Nick), Phone(Home, Work, Cell..)
Addresses(Home, Work, ...) Emails, IM(s), ... So we should provide a search
page which contains all search items that user may use to retrieve desired
contact. I was thinking that I could emit all of searchable information of
CONTACT document, then when I query my view just insert those data which
provided by user and use some don't care notaion for others :(

-- afshin

On Fri, Jul 2, 2010 at 2:15 AM, Robert Newson <robert.newson@gmail.com>wrote:

> You'll need to emit the last name first so that the items with the
> same last name sort together.
>
> function(doc) {
>  emit([doc.lastname, doc.firstname], null);
> }
>
> and then query with ?startkey=["Afzali"]&endkey=["Afzali",{}]
>
> more simply;
>
> function(doc) {
>  emit(doc.lastname, null);
> }
>
> and then query with ?key="Afzali"
>
> B.
>
>
> On Thu, Jul 1, 2010 at 10:29 PM, afshin afzali <a.afzali2003@gmail.com>
> wrote:
> > Sorry, But I  don't know why list rejects my post!!!
> >
> > Ok, assume we have three object keys which emited by a view;
> >
> > {  "FirstName" : "Afshin", "LastName" : "Afzali" }
> > {  "FirstName" : "Omid", "LastName" : "Afzali" }
> > {  "FirstName" : "Ashkan", "LastName" : "Afzali" }
> >
> > I want to retreive all docs which have LastName == "Afzali"
> > -- afshin
> >
>

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