From user-return-15617-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Mon Apr 04 18:41:21 2011 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 7568 invoked from network); 4 Apr 2011 18:41:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Apr 2011 18:41:21 -0000 Received: (qmail 55891 invoked by uid 500); 4 Apr 2011 18:41:19 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 55856 invoked by uid 500); 4 Apr 2011 18:41:19 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 55847 invoked by uid 99); 4 Apr 2011 18:41:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2011 18:41:19 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of luismiguelferreirasilva@gmail.com designates 209.85.213.180 as permitted sender) Received: from [209.85.213.180] (HELO mail-yx0-f180.google.com) (209.85.213.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2011 18:41:13 +0000 Received: by yxe1 with SMTP id 1so3362612yxe.11 for ; Mon, 04 Apr 2011 11:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=jqM7ZOBHirp90hE6AW1W1UQWTr5wlzG3tMs8rs+CmDk=; b=Q900eGunZo2unJSXoRoHmuBDveGRbIYfKfaMnIcTJfnlxMSyxkb7/2G/aUEBCOIi3o +0wyBSPub8R57kTMkzCSHW+UOgwMFGlUlLVQh0BtKP+pC5E9mOumFxxxergdmYarifWH GVs/vXqcyYfMiNFrSvnMAa40WUIUIEbVh9880= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=sq7c28Q6HmMvEOYwOjEM02AUise3f+qvMB4585ITUW8vEM1sryRAlCarFSaYm9cXa6 JF9FlLE2+lNzteyJOkIOE3yXCoXmjx+loo8sUdo34gSa0rjgBg3XWFkPeAKpRa3oBCsE oLUtERa7CEu1ct/jvUGJPQuN8xqTumcsqhkY4= Received: by 10.151.123.21 with SMTP id a21mr1628302ybn.285.1301942453027; Mon, 04 Apr 2011 11:40:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.52.168 with HTTP; Mon, 4 Apr 2011 11:33:36 -0700 (PDT) In-Reply-To: References: From: Luis Miguel Silva Date: Mon, 4 Apr 2011 12:33:36 -0600 Message-ID: Subject: Re: How to query a view by key? To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable That was it! THANK YOU SO MUCH! (jeezzzz...i just couldn't get that to work) ;o)) You're the best! Luis On Mon, Apr 4, 2011 at 11:55 AM, Ryan Ramage wrote: > Try to urlencode your quotes > > eg > > http://xkitten.ac:5984/momdb/_design/os/_view/getOS?key=3D%22esxi4-statel= ess%22&include_docs=3Dtrue > > See if that helps. > > > On Mon, Apr 4, 2011 at 10:34 AM, Luis Miguel Silva > wrote: >> Dear all, >> >> I've been reading the docs but i simply cannot understand how to query >> a view by key?? >> >> For instance, let's imagine these 2 documents: >> { >> =A0 "_id": "esxi4-stateless", >> =A0 "_rev": "2-fe0aeb05ac93d5f5a08d4befc68f10a6", >> =A0 "type": "os", >> =A0 "oslist": [ >> =A0 =A0 =A0 "SOE-RHEL-5_5-2H10_0-Statelite-pm", >> =A0 =A0 =A0 "esxi4-stateless", >> =A0 =A0 =A0 "rhel53-statelite-pm", >> =A0 =A0 =A0 "rhel54-statelite-pm" >> =A0 ], >> =A0 "vmoslist": [ >> =A0 =A0 =A0 "rhel48-stateful", >> =A0 =A0 =A0 "rhel53-stateful", >> =A0 =A0 =A0 "rhel53-stateful-cluster", >> =A0 =A0 =A0 "rhel54-stateful", >> =A0 =A0 =A0 "SOE-RHEL-5_5-2H10_0-Stateful", >> =A0 =A0 =A0 "rhel54-stateful-cluster", >> =A0 =A0 =A0 "rhel53-statelite-vm", >> =A0 =A0 =A0 "rhel54-statelite-vm", >> =A0 =A0 =A0 "SOE-RHEL-5_5-2H10_0-Statelite-vm", >> =A0 =A0 =A0 "win2k3-stateful-32-std", >> =A0 =A0 =A0 "win2k3-stateful-32-ent", >> =A0 =A0 =A0 "win2k3-stateful-32-ent-cluster", >> =A0 =A0 =A0 "win2k3-stateful-64-std", >> =A0 =A0 =A0 "win2k3-stateful-64-ent", >> =A0 =A0 =A0 "win2k3-stateful-64-ent-cluster", >> =A0 =A0 =A0 "win2k8-stateful-64-std", >> =A0 =A0 =A0 "win2k8-stateful-64-ent", >> =A0 =A0 =A0 "win2k8-stateful-64-ent-cluster", >> =A0 =A0 =A0 "win2k8R2-stateful-64-std", >> =A0 =A0 =A0 "win2k8R2-stateful-64-ent", >> =A0 =A0 =A0 "win2k8R2-stateful-64-ent-cluster", >> =A0 =A0 =A0 "P2V-WIN,P2V-RHEL" >> =A0 ] >> } >> >> and >> { >> =A0 "_id": "rhel54-stateful", >> =A0 "_rev": "1-170a66778927ee575ab080a33985d44e", >> =A0 "type": "os", >> =A0 "oslist": [ >> =A0 =A0 =A0 "SOE-RHEL-5_5-2H10_0-Statelite-pm", >> =A0 =A0 =A0 "esxi4-stateless", >> =A0 =A0 =A0 "rhel53-statelite-pm", >> =A0 =A0 =A0 "rhel54-statelite-pm" >> =A0 ] >> } >> >> So i created this view to query them: >> function(doc) { >> =A0 =A0 =A0 =A0if (doc.type =3D=3D "os") >> =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0emit(doc._id, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0os: doc._= id, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0OSLIST: d= oc.oslist, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0VMOSLIST:= doc.vmoslist, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0); >> =A0 =A0 =A0 =A0} >> } >> >> And consuming it directly >> (http://xkitten.ac:5984/momdb/_design/os/_view/getOS) produces: >> {"total_rows":2,"offset":0,"rows":[ >> {"id":"esxi4-stateless","key":"esxi4-stateless","value":{"os":"esxi4-sta= teless","OSLIST":["SOE-RHEL-5_5-2H10_0-Statelite-pm","esxi4-stateless","rhe= l53-statelite-pm","rhel54-statelite-pm"],"VMOSLIST":["rhel48-stateful","rhe= l53-stateful","rhel53-stateful-cluster","rhel54-stateful","SOE-RHEL-5_5-2H1= 0_0-Stateful","rhel54-stateful-cluster","rhel53-statelite-vm","rhel54-state= lite-vm","SOE-RHEL-5_5-2H10_0-Statelite-vm","win2k3-stateful-32-std","win2k= 3-stateful-32-ent","win2k3-stateful-32-ent-cluster","win2k3-stateful-64-std= ","win2k3-stateful-64-ent","win2k3-stateful-64-ent-cluster","win2k8-statefu= l-64-std","win2k8-stateful-64-ent","win2k8-stateful-64-ent-cluster","win2k8= R2-stateful-64-std","win2k8R2-stateful-64-ent","win2k8R2-stateful-64-ent-cl= uster","P2V-WIN,P2V-RHEL"]}}, >> {"id":"rhel54-stateful","key":"rhel54-stateful","value":{"os":"rhel54-st= ateful","OSLIST":["SOE-RHEL-5_5-2H10_0-Statelite-pm","esxi4-stateless","rhe= l53-statelite-pm","rhel54-statelite-pm"]}} >> ]} >> >> But what about if i just want to get the register for _id =3D "esxi4-sta= teless" ?? >> >> I've been trying with: >> http://xkitten.ac:5984/momdb/_design/os/_view/getOS?key=3D"esxi4-statele= ss"&include_docs=3Dtrue >> http://xkitten.ac:5984/momdb/_design/os/_view/getOS?key=3D["esxi4-statel= ess",1,{}]&include_docs=3Dtrue >> and a mixture of different things but i JUST can't seem to get it?! >> >> Could someone please explain how to correctly query the REST web >> service to get what i want?? >> >> Thanks in advance, >> Luis >> >