Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.0.1, 1.1
-
None
-
OS X Lion:
{"couchdb":"Welcome","version":"1.1.0"}(brew installation)
{"couchdb":"Welcome","version":"1.0.1"}
Ubuntu 11.04
Description
When a document with an id is deleted and purged, and a replication process tries to create a document with that id, it does not happen. The replication without the filter works. Ruby test script:
require 'rubygems'
require 'couchrest'
- setup
server = CouchRest.new("http://localhost:5984")
a = server.database('a')
b = server.database('b')
a.recreate!
b.recreate!
- Add a document doc1 to database a and b
a.save_doc("_id" => 'doc1')
b_doc1 = b.save_doc("_id" => 'doc1')
- Delete and purge doc1 from b
b.delete_doc("_id" => 'doc1', "_rev" => b_doc1['rev'])
RestClient.post(File.join(b.root, '_purge'), {'doc1' => [b_doc1['rev']]}.to_json, :content_type => :json )
- Add design with filter
design = a.save_doc("_id" => "_design/temp", "filters" => {"test" => %|function(doc, req){if(['doc1'].indexOf(doc['_id']) >= 0) {return true;}{return false;}}|})
- Replicate and wait for finish
RestClient.post("http://localhost:5984/_replicate", {:source => a.root, :filter => "temp/test", :target => b.root}.to_json, :content_type => :json)
sleep(0.01) while JSON.parse(RestClient.get("http://localhost:5984/_active_tasks")).size > 0
abort "oops" unless b.all_docs['total_rows'] == 1
puts "Test successful"