Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 67242 invoked from network); 7 Sep 2009 17:13:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Sep 2009 17:13:27 -0000 Received: (qmail 73577 invoked by uid 500); 7 Sep 2009 17:13:26 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 73506 invoked by uid 500); 7 Sep 2009 17:13:26 -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 73496 invoked by uid 99); 7 Sep 2009 17:13:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Sep 2009 17:13:26 +0000 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 ben324@gmail.com designates 209.85.219.209 as permitted sender) Received: from [209.85.219.209] (HELO mail-ew0-f209.google.com) (209.85.219.209) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Sep 2009 17:13:15 +0000 Received: by ewy5 with SMTP id 5so1434198ewy.3 for ; Mon, 07 Sep 2009 10:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=Jg21xFVHxr2oFoZVJ0K3n+Rr39xHOi8lUITLCVtVj+M=; b=DyCKDkODMayp88m7hWMZjLzivW+U/K4WiHC9hNEuVthICcUZtKG5FudmOIv3K+sd0v /XTcEG5i5SqCkJ5wXsKe3+ckMUxN4wr56Wta4Q58vVtlacGO3tuayVIL8c5pypXblym0 wc3os4BnKM/XAkHRFZgqfMtu/XKGLUWIlty+0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Vq9AsTta6KAdHxFIHrrn2/xdGrvozRRaXufrVc46dWkVxGPysBX9rOiRKaYINidp5e A+Xc6dTvYv1wLorvDcify5RD0ZWH4tkFIkdQOrmGoAPeDHhGceAqXMT07g0q3adxi1Ax tb0Gvh0TVw0Vl3qLU3TbQS4vyVbsa8qZmBq8E= MIME-Version: 1.0 Received: by 10.211.146.17 with SMTP id y17mr16490671ebn.43.1252343573351; Mon, 07 Sep 2009 10:12:53 -0700 (PDT) In-Reply-To: References: <20090310095437.GA726@tumbolia.org> <20090310115033.GF1876@tumbolia.org> <64a10fff0903100459u2aebf66cj3bfd0044528f3082@mail.gmail.com> <3376B25D-50D8-4FBD-86C5-8501F77446CE@apache.org> <64a10fff0903100523m49817317w9dfa567faa40ac97@mail.gmail.com> <57BA1F75-FE37-4F99-BFCD-76454C0122BB@gmx.de> <20090310123859.GH1876@tumbolia.org> <7db9abd30903100842w2f09fb08i3ca5a9373b8c593e@mail.gmail.com> Date: Mon, 7 Sep 2009 13:12:53 -0400 Message-ID: Subject: Re: JSONQuery From: Ben Browning To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Sorry to bring this thread back from the dead, but I just tried using JSONQuery within a Couch view and everything seems to work fine. I'm using the forked version of JSONQuery from here: http://github.com/jcrosby/jsonquery/tree/master The only gotcha is that JSONQuery expects either a namespace function or a window object to exist. So, I just create a fake window object. Here's an example of a working map view with JSONQuery.js included via a CouchApp macro. You could just as easily copy/paste its contents directly into a view if you aren't using CouchApp. var window = {}; // !code JSONQuery.js JSONQuery = window["JSONQuery"] function(doc) { var customers = JSONQuery("$.customers[?purchases > 21]", doc); for (var i = 0; i < customers.length; i++) { emit(customers[i].name, customers[i].purchases); } }