Ah, I didn't think of that.  Having hidden code to check that the name field
matches the id is a real kludge.  So copy doesn't work in _users.  Using put
to copy would be a real pita because I have attachments.  I guess I'll have
to create a new doc in another db with a one-to-one relationship with the
users.

This is the second time I've gotten burned by storing stuff in _users.  The
docs should say to not store stuff in _users or couch should disallow it.


On Sat, Mar 5, 2011 at 3:58 AM, Joe Freeman <[email protected]> wrote:

> I've never tried out COPY, but I suspect this is because when you copy
> the document over, the document's 'name' property stays the same
> ('[email protected]'). When the new document is validated, it has an ID of
> 'org.couchdb.user:xxx', but the name property is '[email protected]'. The
> validation rule requires that the document ID is 'org.couchdb.user:'
> followed by the name.
>
> If you want to rename a user, you'll probably need to PUT the new user
> document manually with an updated 'name' property.
>
> On 5 March 2011 10:07, Mark Hahn <[email protected]> wrote:
> > When I try a copy request in the _users db I get the error ...
> >
> >    403, forbidden, Doc ID must be of the form org.couchdb.user:name
> >
> > The request as shown in the couch log is :
> >
> > [debug] [<0.26409.36>] "COPY" /_users/org.couchdb.user%3Aq%40q.qa {1,1}
> > Headers: [{'Connection',"close"},
> >          {'Content-Type',"application/json"},
> >          {'Cookie'," ... snip ..."},
> >          {"Destination","org.couchdb.user:xxx"},
> >          {'Host',"localhost"},
> >          {'Transfer-Encoding',"chunked"}]
> >
> > I've also tried encoding the Destination header
> > as {"Destination","org.couchdb.user%3Axxx"}.
> >
> > The request path is url encoded the same way as in all of my other
> working
> > requests. The id shown above works in get, put, etc.  I'm using
> > jquery.couch.js so I'm pretty sure the only thing I could be doing wrong
> is
> > the Destination header. jquery.couch.js is formatting everything but the
> > headers.
> >
> > Any ideas?
> >
>



-- 
Mark Hahn
Website Manager
[email protected]
949-229-1012

Reply via email to