You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Tim (JIRA)" <ji...@apache.org> on 2009/03/18 16:25:50 UTC

[jira] Created: (COUCHDB-294) in validation functions, new_doc does not contain the rev that was sent in the request

in validation functions, new_doc does not contain the rev that was sent in the request 
---------------------------------------------------------------------------------------

                 Key: COUCHDB-294
                 URL: https://issues.apache.org/jira/browse/COUCHDB-294
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
    Affects Versions: 0.9
         Environment: ubuntu
            Reporter: Tim


The new_doc in a validation does not contain the revision that you sent in the post/put request. 

In this log, each block contains a log of 

[info] old_doc
[info] new_doc
[info] request

{{{


new doc
-------

[info] [<0.68.0>] OS Process Log Message: null
[info] [<0.68.0>] OS Process Log Message: {"_id": "wibble","_rev": "1-3141321355","_revisions": {"start": 1,"ids": ["3141321355"]}}
[info] [<0.935.0>] 127.0.0.1 - - 'PUT' /conflict/wibble 201


update 1st rev, no conflict
---------------------------

[info] [<0.68.0>] OS Process Log Message: {"_id": "wibble","_rev": "1-3141321355","_revisions": {"start": 1,"ids": ["3141321355"]}}
[info] [<0.68.0>] OS Process Log Message: {"_id": "wibble","_rev": "2-1123114967","_revisions": {"start": 2,"ids": ["1123114967","3141321355"]}}
[info] [<0.977.0>] 127.0.0.1 - - 'POST' /conflict/_bulk_docs 201

As you can see on this second request, the document sent will have had a rev of "1-3141321355" but in the validation function the new_doc has the rev that is just about to be written to disk.. I cannot see a way to access the rev that was sent across the request.

}}}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (COUCHDB-294) in validation functions, new_doc does not contain the rev that was sent in the request

Posted by "Jan Lehnardt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Lehnardt closed COUCHDB-294.
--------------------------------

    Resolution: Invalid

The behaviour looks correct to me. The validation function runs before the document is written to the database which is when it gets the new rev id.

Feel free to reopen the issue with a test script that demonstrates the erroneous behaviour (bonus points for a patch to the JavaScript or etap test suite :).

> in validation functions, new_doc does not contain the rev that was sent in the request 
> ---------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-294
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-294
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 0.9
>         Environment: ubuntu
>            Reporter: Tim
>
> The new_doc in a validation does not contain the revision that you sent in the post/put request. 
> In this log, each block contains a log of 
> [info] old_doc
> [info] new_doc
> [info] request
> {{{
> new doc
> -------
> [info] [<0.68.0>] OS Process Log Message: null
> [info] [<0.68.0>] OS Process Log Message: {"_id": "wibble","_rev": "1-3141321355","_revisions": {"start": 1,"ids": ["3141321355"]}}
> [info] [<0.935.0>] 127.0.0.1 - - 'PUT' /conflict/wibble 201
> update 1st rev, no conflict
> ---------------------------
> [info] [<0.68.0>] OS Process Log Message: {"_id": "wibble","_rev": "1-3141321355","_revisions": {"start": 1,"ids": ["3141321355"]}}
> [info] [<0.68.0>] OS Process Log Message: {"_id": "wibble","_rev": "2-1123114967","_revisions": {"start": 2,"ids": ["1123114967","3141321355"]}}
> [info] [<0.977.0>] 127.0.0.1 - - 'POST' /conflict/_bulk_docs 201
> As you can see on this second request, the document sent will have had a rev of "1-3141321355" but in the validation function the new_doc has the rev that is just about to be written to disk.. I cannot see a way to access the rev that was sent across the request.
> }}}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.