incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <kxe...@gmail.com>
Subject Re: overwrite document without revision?
Date Sun, 10 Nov 2013 21:51:43 GMT
On Mon, Nov 11, 2013 at 1:36 AM, Ryan Mohr <ryan@kumu.io> wrote:
> Can you expand on this more or point me to documentation that covers
> this in detail?


>From wiki link you posted:

> rather than being the parent revision ID to be matched against, it's the existing revision
ID that will be saved as-is into the database.

It's easy to see:

[~]$ curl http://localhost:5984/db/foo
{
     "_id": "foo",
     "_rev": "3-00e7ae9eeb50cabd81126e9f39b871cf"
}

[~]$ curl -X PUT http://localhost:5984/db/foo -d
'{"bar":"baz","_rev":"1-ABC"}' -H "Content-Type:application/json"
{"error":"conflict","reason":"Document update conflict."}

[~]$ curl -X PUT 'http://localhost:5984/db/foo?new_edits=false' -d
'{"bar":"baz","_rev":"1-ABC"}' -H "Content-Type:application/json"
{"ok":true,"id":"foo","rev":"1-ABC"}

[~]$ curl -X PUT 'http://localhost:5984/db/foo?new_edits=false' -d
'{"bar":"baz","_rev":"9-CDE"}' -H "Content-Type:application/json"
{"ok":true,"id":"foo","rev":"9-CDE"}

[~]$ curl 'http://localhost:5984/db/foo?open_revs=all' -H
"Accept:application/json"
[
    {
        "ok": {
            "_id": "foo",
            "_rev": "9-CDE",
            "bar": "baz"
        }
    },
    {
        "ok": {
            "_id": "foo",
            "_rev": "3-00e7ae9eeb50cabd81126e9f39b871cf"
        }
    },
    {
        "ok": {
            "_id": "foo",
            "_rev": "1-ABC",
            "bar": "baz"
        }
    }
]



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

Mime
View raw message