1 Nov 2009 12:27
Re: What happens with a document, if a conflict is not resolved?
On Fri, Oct 30, 2009 at 08:37:36PM -0400, Adam Kocoloski wrote: > The response format is a slightly awkward Array -- I believe the first > revision is the winning one. This is definitely not true. For example, I can get the database into a state where there are three conflicting versions, and the winning version is the middle one returned by open_revs=all $ curl http://127.0.0.1:5984/conflict_test/test?conflicts=true {"_id":"test","_rev":"10-ca7d1f8bc31d20ad4898e4024547c4c6","hello":"baz","_conflicts":["9-9b4928288c4fc3087833549752bdcdc3","9-2438fa9601119c8fe2c0b2f4a688f65f"]} $ curl http://127.0.0.1:5984/conflict_test/test?open_revs=all [{"ok":{"_id":"test","_rev":"9-2438fa9601119c8fe2c0b2f4a688f65f","hello":"bar"}}, {"ok":{"_id":"test","_rev":"10-ca7d1f8bc31d20ad4898e4024547c4c6","hello":"baz"}}, {"ok":{"_id":"test","_rev":"9-9b4928288c4fc3087833549752bdcdc3","hello":"foo"}}] Code to do this is attached. Regards, Brian.
require 'rubygems' require 'restclient' require 'json' DB="http://127.0.0.1:5984/conflict_test" # Write multiple documents as all_or_nothing, can introduce conflicts def writem(docs) JSON.parse(RestClient.post("#{DB}/_bulk_docs", {(Continue reading)
RSS Feed