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 4EE1ADF10 for ; Tue, 18 Sep 2012 08:17:30 +0000 (UTC) Received: (qmail 25130 invoked by uid 500); 18 Sep 2012 08:17:28 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 24695 invoked by uid 500); 18 Sep 2012 08:17:25 -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 24660 invoked by uid 99); 18 Sep 2012 08:17:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2012 08:17:24 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [66.111.4.27] (HELO out3-smtp.messagingengine.com) (66.111.4.27) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2012 08:17:17 +0000 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 98474205E7 for ; Tue, 18 Sep 2012 04:16:56 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute6.internal (MEProxy); Tue, 18 Sep 2012 04:16:56 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:content-type :content-transfer-encoding:subject:message-id:date:to :mime-version; s=smtpout; bh=2t4CFG8AbFgTwgSeplyhsXh6drA=; b=F8p xCbVylYjpqo5v19C+HnwDJpZAW6tLhRzklKLHQgcyBxsi3Q4mfmebZS6/9rNfGCH YK/p+Xro/V0zNLFo6RZd9E2RxxMpMoDq2VDIVNk7JZz6RzEkKHLxc/vh/SddnIYe KjRIhqgO3IB4UC/xX58r3qkeLzCRfSZOg3EEMlAw= X-Sasl-enc: tRjgcY+OUZS/LB+r+pL1dB80quzdrHszJDITCqZKJZTS 1347956216 Received: from [192.168.1.108] (unknown [194.79.160.134]) by mail.messagingengine.com (Postfix) with ESMTPA id 4670B4836E3 for ; Tue, 18 Sep 2012 04:16:56 -0400 (EDT) From: Robin Berjon Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Rewrite inside of a path segment Message-Id: Date: Tue, 18 Sep 2012 10:16:55 +0200 To: user@couchdb.apache.org Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) X-Mailer: Apple Mail (2.1486) Hi all, I am using rewrites in order to expose a nice API but I am hitting a = problem with rewrites. The constraints I have are as follows (my app is = not a blog, but I'll use that for examples as it'll be simpler). First, = I would like these three basic operations to work: GET /blog/this-is-my-title PUT /blog/this-is-my-title DELETE /blog/this-is-my-title So far so good. But the second constraint is that "this-is-my-title" is = not the ID of the relevant documents, but rather the value of one of = their fields. It is unique within a type, but not unique across all = types in the DB (otherwise I'd just use it as the ID and call it a day). = So I generate IDs based on concatenating the type and that field. I got this working easily for GET and PUT, using rewrites that point = respectively to a view indexed on the right type plus field, and an = update handler that generates the correct ID on the fly. For DELETE though, I'm stuck. I've tried a bunch of variations from = rewriting to the document itself to rewriting to an update handler that = sets the _deleted attribute but I can't seem to work my way to a = solution. The problem is that I need a rewrite that invariably accepts parameters = that don't fall at the / boundary. Typically: { from: "/blog/*" , to: "../../blog.*" , method: "DELETE" } And that doesn't work. It just invariably encodes the * or :id, or = whatnot. Have I missed something? I of course could simply expose = another ID for DELETE or ugly IDs everywhere, but that completely = defeats the point of having rewrites in the first place. Thanks for any suggestions! --=20 Robin Berjon - http://berjon.com/ - @robinberjon