couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: Update function difficutlties on 1.1
Date Thu, 16 Jun 2011 21:59:04 GMT
Function works just fine for me locally on 1.1.0.

The only reason that you should get a 409 is if the document is
updated concurrently. Update functions are not immune.

B.

On 16 June 2011 21:59, JC de Villa <jc.devilla@gmail.com> wrote:
> Hi all,
>
> I have 1.2 and 1.1 running on my dev machine and found that the update
> handlers seems to work differently. All of my previous update handlers
> work just fine, but a new handler that works fine on 1.2 will not work
> on 1.1, getting a 409 conflict.
>
> The function goes:
>
> "remove": "function(doc, req){
>    if(!req.query.position){
>       return[null, 'Error'] }
>    n = doc.names;
>    for (var i in n){
>     if(n[i] == req.query.position){
>      delete n[i]
>      }
>     }
>    doc['names'] = n;
>    return [doc, 'OK']
>  }"
>
> 1.2 was a fairly recent build (less than a week old), and 1.1 from the
> official tarball.
>
> I tried the same update handler on an older build of 1.2 (built
> roughly around march on a different machine) and it works there as
> well.
>
> I've tried asking it nicely with doc._rev=doc._rev just before the
> final return, but still get the conflict.
>
> My dev machine runs kubuntu 11.04 and has 1.1 and 1.2. I've also
> tested on windows XP and 7, and used 1.1 and 1.0.2. Wasn't able to try
> 1.2 on windows... my build attempt failed rather miserably.
>
> Any ideas? I'm all out, and my attempt at building a couch on windows
> has really got my migraine going.
>
>
> JC de Villa
>

Mime
View raw message