Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 88538 invoked from network); 10 Jun 2008 19:26:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jun 2008 19:26:24 -0000 Received: (qmail 36953 invoked by uid 500); 10 Jun 2008 19:26:27 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 36716 invoked by uid 500); 10 Jun 2008 19:26:26 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 36705 invoked by uid 99); 10 Jun 2008 19:26:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2008 12:26:26 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of brking@gmail.com designates 64.233.166.176 as permitted sender) Received: from [64.233.166.176] (HELO py-out-1112.google.com) (64.233.166.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2008 19:25:35 +0000 Received: by py-out-1112.google.com with SMTP id u52so1061306pyb.13 for ; Tue, 10 Jun 2008 12:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=twydiFtQVtF0M9zTiG/6dUTbM7ywbXIGBxQLQKwPJqw=; b=tyrmSpCqfvG3R3QguCRfL1QmHMM15bTZDJkLt0YKHwoImYHcfgvNVq53qbHuuYTZvh OXQlh6hrIk73Eq5UQgRNj8nBWFeire6kWcIX8voJWyGECb0eLd/UswI4IWPXOy2UR63o o2NkOrraFx0RavmY8g7i+fdGGT3Ugznmfg6GY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=i6HFEMQjuF96YJ3BBikjwx80QhGcq7RESubJk5k1RsKDkwSS53ecS3dtNa6lU+04Zw aKAhT/dEn4dhHmza72/dnm8vQ3/UUN/4PjKBGpRz7hAx+bKY5mWkaNB8pv23lcOlSKMI e9R79lIzHqaxS6ZvPr+0fQ7fXxwmQmvimjzXo= Received: by 10.114.53.1 with SMTP id b1mr5473603waa.165.1213125951773; Tue, 10 Jun 2008 12:25:51 -0700 (PDT) Received: by 10.114.182.11 with HTTP; Tue, 10 Jun 2008 12:25:51 -0700 (PDT) Message-ID: <888cd9180806101225v6afd19fbhda9cf5d53fa42a33@mail.gmail.com> Date: Tue, 10 Jun 2008 15:25:51 -0400 From: "Brad King" To: couchdb-user@incubator.apache.org Subject: Re: 500 server error posting a view In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <888cd9180806101101u28b29cban871829654da09b05@mail.gmail.com> <888cd9180806101118sa8d2671gee270216d6500dbe@mail.gmail.com> <888cd9180806101203i1eaa8eacwc15ddc7cf4c31f9@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org When I remove the text/ prefix I still get the 500 error, and the query interface in the browser starts throwing "undefined" alert boxes. One thing I find confusing is the error is saying application/json is not a defined query language. Is my POST supposed to have Content-Type application/json or text/javascript? I see a mix of both here: http://wiki.apache.org/couchdb/Views "Temporary views are not stored in the database, but rather executed on demand. To execute a temporary view, you make an HTTP POST request to the URI /{dbname}/_temp_view, where the body of the request contains the code of the view function and the Content-Type header is set to text/javascript. " OR http://wiki.apache.org/couchdb/HttpViewApi "Ad Hoc Views One-off queries (eg. views you don't want to save in the CouchDB database) can be done via the special view _temp_view: POST /some_database/_temp_view HTTP/1.0 Content-Length: 48 Date: Mon, 10 Sep 2007 17:11:10 +0200 Content-Type: application/json { "map" : "function(doc) { if (doc.foo=='bar') { emit(null, doc.foo); } }" } " Seems like conflicting info to accomplish the same thing. On 6/10/08, Jan Lehnardt wrote: > > On Jun 10, 2008, at 21:03, Brad King wrote: > > > I tried adding the "language" specifier, but no change. The couch.ini > > section you mentioned looks like this: > > > > [Couch Query Servers] > > > > text/javascript=/usr/local/bin/couchjs -f > > /usr/local/share/couchdb/server/main.js > > > > drop the "text/" prefix and try again, > > thx, > Jan > -- > > > > > > > > > > On 6/10/08, Chris Anderson wrote: > > > > > Brad, > > > > > > there's an (optional) parameter on view json. try this: > > > > > > { > > > "language": "javascript", > > > "map" : "function(doc) { emit(null, doc); } " > > > } > > > > > > although "javascript" is supposed to be the default, so it makes me > > > wonder if something else s the source of your error. > > > > > > The problem could be with your couch.ini file - > > > /usr/local/etc/couchdb/couch.ini should have a line in > it like this > > > (which is also the default): > > > > > > [Couch Query Servers] > > > > > > javascript=/usr/local/bin/couchjs > /usr/local/share/couchdb/server/main.js > > > > > > > > > On Tue, Jun 10, 2008 at 11:18 AM, Brad King wrote: > > > > > > > Chris: ah, yes I screwed up the URL, however I still get the 500 after > > > > fixing this: > > > > > > > > POST /product/_temp_view HTTP/1.0 > > > > Content-Type: application/json > > > > Content-Length: 55 > > > > Host: d0002rptdb02:5984 > > > > > > > > { > > > > "map" : "function(doc) { emit(null, doc); } " > > > > } > > > > > > > > Different error though > > > > > > > > HTTP/1.0 500 Internal Server Error > > > > Server: inets/develop > > > > Date: Tue, 10 Jun 2008 18:12:52 GMT > > > > Cache-Control: no-cache > > > > Pragma: no-cache > > > > Expires: Tue, 10 Jun 2008 18:12:52 GMT > > > > Connection: close > > > > Content-Type: text/plain;charset=utf-8 > > > > > > > > > {"error":"query_language_unknown","reason":"application\/json"} > > > > > > > > > > > > Jan, this is the correct format for an ad-hoc view, no? the page you > > > > linked me to is where I got the info. > > > > > > > > BTW I can browse the database just fine with a web browser, and the > > > > default query runs ok in a browser as well. > > > > > > > > Thanks > > > > > > > > On 6/10/08, Chris Anderson wrote: > > > > > > > > > Brad, > > > > > > > > > > It look like the url: > > > > > > > > > > > > > > > > POST /product/_test_view HTTP/1.0 > > > > > > > > > > > > > > > > > > > > > > should be /product/_design/test_view (for a named view) > > > > > > > > > > or /product/_temp_view > > > > > > > > > > assuming your db name is product. > > > > > > > > > > Hope that helps. > > > > > > > > > > Chris > > > > > > > > > > -- > > > > > Chris Anderson > > > > > http://jchris.mfdz.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Chris Anderson > > > http://jchris.mfdz.com > > > > > > > > > > > >