incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Leblanc <sim.lebl...@gmail.com>
Subject Re: Rewrite /user/bob to user:bob
Date Fri, 19 Aug 2011 19:06:23 GMT
That's what I'm trying to do right now, in conjunction with Benoit Chesneau's advice: I redirect
user/:key to _list/show/user, where user is the view you describe.
Actually I use docids in the form user:bob. In the user view, I split doc._id around the colon
character and if the first part is user, I emit the second part as the key and doc as the
value.

The problem is for update functions: I can't redirect from the list after calling getRow()
(see COUCHDB-514).

Christopher Bonhage just supplied a patch tor COUCHDB-1229. Should I quit using slashes in
docids anyway?

Le 19 août 2011 à 12:44, Christian Carter a écrit :

> On Thu, Aug 18, 2011 at 1:47 PM, Simon Leblanc <sim.leblanc@gmail.com> wrote:
>> 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.
> 
> I have option #4 for you: instead of using a show function, use a
> list.  You still use UUIDs for the ID, and you just have a view that
> emits all "users" keyed on the unique username.  Since that username
> is (theoretically) unique, your list function can be designed to just
> show one user ever, and then you rewrite to it.
> 
> Maybe.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message