From user-return-18222-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Thu Oct 6 23:20:54 2011 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CE8707F2B for ; Thu, 6 Oct 2011 23:20:54 +0000 (UTC) Received: (qmail 40948 invoked by uid 500); 6 Oct 2011 23:20:52 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 40907 invoked by uid 500); 6 Oct 2011 23:20:52 -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 40899 invoked by uid 99); 6 Oct 2011 23:20:52 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Oct 2011 23:20:52 +0000 Received: from localhost (HELO mail-iy0-f180.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Oct 2011 23:20:50 +0000 Received: by iahk25 with SMTP id k25so5456367iah.11 for ; Thu, 06 Oct 2011 16:20:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.47.202 with SMTP id o10mr2301466ibf.2.1317943249962; Thu, 06 Oct 2011 16:20:49 -0700 (PDT) Received: by 10.231.65.79 with HTTP; Thu, 6 Oct 2011 16:20:49 -0700 (PDT) In-Reply-To: References: Date: Fri, 7 Oct 2011 00:20:49 +0100 Message-ID: Subject: Re: query parameters in Update Handler functions From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable & is a shell metacharacter causing curl to run in the background. Everything after it is ignored. try; curl -vX PUT 'http://localhost:5984//_design//_update/t= est-qparams/?foo=3Dbar&baz=3Dfaz' B. On 7 October 2011 00:08, Ron Dyck wrote: > I think it must be how I was using curl, discovered it was not a > problem within my php application. > Thanks for the help. Am curious what I'm doing wrong with curl though. > > Here's my curl statement: > curl -vX PUT http://localhost:5984//_design//_update/= test-qparams/?foo=3Dbar&baz=3Dfaz > > On Thu, Oct 6, 2011 at 5:26 PM, Ryan Ramage wrote= : >> Works for me on 1.1 =A0are you on a recent couch? >> Maybe this might help you debug: >> >> function(doc, req) { >> =A0 =A0 =A0 =A0var resp =3D =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0headers : { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 'Content-Type' : 'application/json' >> =A0 =A0 =A0 =A0 =A0 =A0}, >> =A0 =A0 =A0 =A0 =A0 =A0 body : JSON.stringify(req.query) >> =A0 =A0 =A0 =A0}; >> =A0 =A0 =A0 =A0return [null, resp]; >> } >> >> On Thu, Oct 6, 2011 at 2:11 PM, Ron Dyck wrote: >>> I was attempting to use the=A0"in-place" Update Handler function and ra= n >>> into an issue with the number of query parameters. After copying the >>> function from the test suite to ensure I had the proper code, I found >>> that I was only able to use the first of the query parameters. >>> >>> The documentation shows the example: >>> http://127.0.0.1:5984//_design//_update/in-p= lace/?field=3Dtitle&value=3Dtest >>> In my testing, (after replacing with proper values, I >>> was unable to read the last param 'value'. >>> >>> Here's my code: >>> "in-place": "(function (doc, req) {var field =3D req.query.field; var >>> value =3D req.query.value; var message =3D 'set ' + field + ' to ' + >>> value; doc[field] =3D value; return [doc, message];})", >>> >>> The value of req.query.field is good. >>> >>> Your help is appreciated. >>> >>> ron >>> -- >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> Ron Dyck >>> pulpfree1@gmail.com >>> www.webbtech.net >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >> > > > > -- > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Ron Dyck > pulpfree1@gmail.com > www.webbtech.net > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >