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 ADA428B96 for ; Thu, 18 Aug 2011 18:48:07 +0000 (UTC) Received: (qmail 18081 invoked by uid 500); 18 Aug 2011 18:48:06 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 18019 invoked by uid 500); 18 Aug 2011 18:48:05 -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 18011 invoked by uid 99); 18 Aug 2011 18:48:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 18:48:05 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sim.leblanc@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 18:47:57 +0000 Received: by vws16 with SMTP id 16so2599380vws.11 for ; Thu, 18 Aug 2011 11:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:content-type:subject:date:message-id:to:mime-version:x-mailer; bh=WIvMKT0VsK/t4mf9C4tO28FSLBnlC7bMarm2TQwL/F4=; b=ulnDB/IsdsPGTNxhpAn/wYLCyPAeaKyt8xRLmlNM5O1GA1xvtg9BarFeVixViFrNcp f44ahIygLY7rNBLmni3gk7uFEUdQFqSDYDPNwXoF5j+VSqbxxlXUHOsh4wC87IW+6Ywk ruPTnPAnbkFN2L+2L0GxZiEr47gB4GrVMaJkM= Received: by 10.52.95.201 with SMTP id dm9mr1070796vdb.95.1313693256636; Thu, 18 Aug 2011 11:47:36 -0700 (PDT) Received: from dynamic-oit-vapornet-c-478.princeton.edu (dynamic-oit-vapornet-c-478.Princeton.EDU [140.180.10.98]) by mx.google.com with ESMTPS id cg6sm1817657vdc.29.2011.08.18.11.47.34 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 11:47:35 -0700 (PDT) From: Simon Leblanc Content-Type: multipart/alternative; boundary="Apple-Mail=_D42D550E-1DA4-4FAF-AB0B-2824D28DEE87" Subject: Rewrite /user/bob to user:bob Date: Thu, 18 Aug 2011 14:47:34 -0400 Message-Id: <859C3929-BDEE-41B5-928F-CA8A099AFBED@gmail.com> To: user@couchdb.apache.org Mime-Version: 1.0 (Apple Message framework v1244.3) X-Mailer: Apple Mail (2.1244.3) --Apple-Mail=_D42D550E-1DA4-4FAF-AB0B-2824D28DEE87 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Hello, I'm trying to write a couchapp with multiple users. Two users can't have = the same name, since I want to access user bob's profile through = /user/bob. Similarly, I store other documents (let's call them stuffs) with unique = ids that I would like to access through /stuff/somestuff. A user can have the same name as a stuff, and vice versa. That's why I = can't use bob or somestuff as _id (otherwise I couldn't have a stuff = named bob or a user named somestuff). I see 3 options: use different databases for users and stuffs, but that means two design = documents and it kind of defeats the purpose of couchapps use uuids and deal with names in a custom manner. Sounds difficult. I = would really prefer the third option: use a naming convention for ids, like user:bob and stuff:somestuff. My favorite choice so far is the third option. The colon can be replaced = by any character, like dash, underscore, comma, @ or even nothing if = this can help. The prefix can also be a postfix. I initially tried with a forward slash which was perfect until I = realized it was not really supported and it caused problems with update = functions (see COUCHDB-1229). Is it possible to rewrite /user/bob to, for instance, = /_show/profile/user:bob or /_show/profile/user_bob ? I tried {"from": "user/*", "to": "_show/profile/user:bob"} and variants = with no success. If it is not possible, what would be the best alternative? Thanks a lot for your help, Simon PS: For the sake of learning, I'm trying to write a pure couchapp = without client-side javascript=85= --Apple-Mail=_D42D550E-1DA4-4FAF-AB0B-2824D28DEE87--