Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
couchdb.mapping.Document rev attribute
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
adam.cajf  
View profile  
 More options Jul 17 2012, 9:51 am
From: "adam.cajf" <adam.c...@gmail.com>
Date: Tue, 17 Jul 2012 06:51:01 -0700 (PDT)
Local: Tues, Jul 17 2012 9:51 am
Subject: couchdb.mapping.Document rev attribute

I'd like to know why rev property of the couchdb.mapping.Document class is read-only
attribute. Even id attribute can be set, and I need in my project to create
a new Document with rev, which I obtain from CouchDB view. I know that rev
is generated in CouchDB, but that's a pity that creators didn't predict
such an exception. Moreover, in my humble opinion there should be a get
method for the Document class that could obtain many ids as a paramter.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Shorin  
View profile  
 More options Jul 17 2012, 10:48 am
From: Alexander Shorin <kxe...@gmail.com>
Date: Tue, 17 Jul 2012 18:48:59 +0400
Local: Tues, Jul 17 2012 10:48 am
Subject: Re: couchdb.mapping.Document rev attribute
Hi Adam!

Mostly because this is system internal field, that not supposed to be
touched by clients. Accidental his changing may create unexpectable
conflict situations.
To create mapping.Document instance based on view result you have two ways:
1. Use ViewField to gain result data and Document class as result row wrapper.
2. Wrap view result manually by Document class on instance
initialization. Document revision would be automatically set by `_rev`
key parameter.

--
,,,^..^,,,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
adam.cajf  
View profile  
 More options Jul 18 2012, 12:09 pm
From: "adam.cajf" <adam.c...@gmail.com>
Date: Wed, 18 Jul 2012 09:09:39 -0700 (PDT)
Local: Wed, Jul 18 2012 12:09 pm
Subject: Re: couchdb.mapping.Document rev attribute

Hi Kxepal,
*
*
Thank you for your answer.

I have another case...
There is REST API. Let's assume that user send a document to be updated
with the rev parameter. Then if it was possible to set rev in Document and
there was a conflict I could receive from couchdb the exception:

HTTP/1.1 409 Conflict
Server: CouchDB/1.2.0 (Erlang OTP/R15B)
Date: Wed, 18 Jul 2012 15:48:21 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 58
Cache-Control: must-revalidate

{"error":"conflict","reason":"Document update conflict."}

and I would like to have access to this exception and not checking manually
if rev in the document in couchdb is equal to the rev given by user.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Shorin  
View profile  
 More options Jul 21 2012, 12:35 am
From: Alexander Shorin <kxe...@gmail.com>
Date: Sat, 21 Jul 2012 08:35:34 +0400
Local: Sat, Jul 21 2012 12:35 am
Subject: Re: couchdb.mapping.Document rev attribute

On Wed, Jul 18, 2012 at 8:09 PM, adam.cajf <adam.c...@gmail.com> wrote:
> I have another case...
> There is REST API. Let's assume that user send a document to be updated with
> the rev parameter. Then if it was possible to set rev in Document and there
> was a conflict I could receive from couchdb the exception

The base logic is that on conflict situation you need to fetch latest
version and update his data from outdated one if you'd like to force
override data. However, you're still able to set revision by accessing
to Mapping internals:

doc._data['_rev'] = newrev

This is not very correct, because for most conflicts better to analyze
both documents and decide how to merge their data, but if you're sure
and really want just to override new document version by old one you'd
 need to explicitly make a hack to note that behavior for others -
sounds quite fair.

--
,,,^..^,,,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »