incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Jackson <james.jack...@cern.ch>
Subject Re: Updates methods
Date Thu, 09 Sep 2010 08:18:24 GMT
Oh, also, as mentioned in that ticket, this functionality should only be called on user interaction;
replication should not modify the documents. Well, at least in what I want to do - but then
again the 'update' method could have an isReplication field passed, for example, to allow
the user to do whatever they want.

Regards,
James.

On 9 Sep 2010, at 09:11, Johannes J. Schmidt wrote:

> In my application i use update handlers to insert user information into
> the documents.
> However, I am not able to insert that information when updating
> attachments via the attachment API. I can write an update function to
> update attachments but
> 1) I have to encode those attachments as Base64 and
> 2) it reaches a limit: Uncaught error in HTTP request:
> {exit,{body_too_large,content_length}}
> 
> Greetings
> Johannes
> 
> Am Donnerstag, den 09.09.2010, 08:57 +0100 schrieb James Jackson:
>> There is discussion on it in this ticket:
>> 
>> https://issues.apache.org/jira/browse/COUCHDB-441
>> 
>> However, it appears to have morphed into what we have available today.
>> 
>> Regards,
>> James.
>> 
>> On 9 Sep 2010, at 08:56, Johannes J. Schmidt wrote:
>> 
>>> Hi James,
>>> 
>>> From my point of knowledge this is not possible.
>>> I would also very appreciate such a functionality to achieve exactly the
>>> same as you describe.
>>> I think this would be useful for many use cases.
>>> 
>>> Does anybody knows more about this topic? Is this a planned feature?
>>> 
>>> Greetings
>>> Johannes
>>> 
>>> Am Donnerstag, den 09.09.2010, 08:46 +0100 schrieb James Jackson:
>>>> Hi Johannes,
>>>> 
>>>> Thank you - so from what I can see, it isn't actually possible in intercept
all document inserts and modify them server-side? The update handler functionality appears
to only be able to modify existing docs, or create a new one, and even then has to be called
with a special URL syntax.
>>>> 
>>>> What I would like to achieve (for implementation of a security policy) is
to be able to add some information from the userCtx object to every document on an initial
PUT / POST, without requiring the user to call something explicitly different. While I could
steam ahead and patch our version of CouchDB to perform this, I'd rather not diverge from
the trunk more than we already have (with the addition of custom HTTP auth handlers).
>>>> 
>>>> Is there any way to accomplish this at present?
>>>> 
>>>> Regards,
>>>> James.
>>>> 
>>>> On 9 Sep 2010, at 06:08, Johannes J. Schmidt wrote:
>>>> 
>>>>> Hi James,
>>>>> 
>>>>> Update handlers are not automatically executed on regular document
>>>>> updates. Instead, you have to PUT your update to an URL like
>>>>> 
>>>>> $HOST/$DB/_design/update/_update/add_user
>>>>> 
>>>>> You will have to process every property manually inside the update
>>>>> function.
>>>>> 
>>>>> Read more about update handlers in the wiki:
>>>>> http://wiki.apache.org/couchdb/Document_Update_Handlers
>>>>> 
>>>>> Greetings
>>>>> Johannes
>>>>> Am Donnerstag, den 09.09.2010, 00:04 +0100 schrieb James Jackson:
>>>>>> Hi,
>>>>>> 
>>>>>> I'm trying to implement a method to modify all documents before they
are written to the DB. From my poking around in various tickets, I believe the updates entry
in a design document is what I'm after (I'm running 1.0.1).
>>>>>> 
>>>>>> I have inserted the following design document into my database:
>>>>>> 
>>>>>> {
>>>>>> "_id":"_design/update",
>>>>>> "_rev":"1-8800f3bdde13e5bcf6738635f0265b6d",
>>>>>> "language":"javascript",
>>>>>> "updates" : {
>>>>>>    "add_user":"function(doc, req){doc.newauth = req.userCtx; return
[doc, \"ok\"];}"
>>>>>> }
>>>>>> }
>>>>>> 
>>>>>> However, this does not appear to get run when putting a document
to the database (nothing in the debug log but the usual). Is this functionality supported?
Am I doing something funny? All help appreciated!
>>>>>> 
>>>>>> Regards,
>>>>>> James.
>>>>> 
>>>>> -- 
>>>>> Netzmerk GbR
>>>>> Johannes J. Schmidt
>>>>> 
>>>>> http://netzmerk.com
>>>>> 0157 79 76 20 30
>>>>> 
>>>>> Am Vierstückenpfuhl 3a
>>>>> 14167 Berlin
>>>> 
>>> 
>>> -- 
>>> Netzmerk GbR
>>> Johannes J. Schmidt
>>> 
>>> http://netzmerk.com
>>> 0157 79 76 20 30
>>> 
>>> Am Vierstückenpfuhl 3a
>>> 14167 Berlin
>> 
> 
> -- 
> Netzmerk GbR
> Johannes J. Schmidt
> 
> http://netzmerk.com
> 0157 79 76 20 30
> 
> Am Vierstückenpfuhl 3a
> 14167 Berlin


Mime
View raw message