incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: Newbie Question about View's Startkey Match (Forked)
Date Thu, 01 Jul 2010 21:45:52 GMT
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
View raw message