You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/09/01 19:36:36 UTC

[GitHub] [couchdb] nickva opened a new pull request #3123: Allow creating new deleted documents

nickva opened a new pull request #3123:
URL: https://github.com/apache/couchdb/pull/3123


   This makes it compatible with CouchDB <= 3.x where we can create deleted
   documents.
   
   How to check:
   
   ```
   $ http put $DB1/mydb
   $ http put $DB1/mydb/foo _deleted:='true' a=b
   {
       "id": "foo",
       "ok": true,
       "rev": "1-ad7eb689fcae75e7a7edb57dc1f30939"
   }
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] davisp commented on a change in pull request #3123: Allow creating new deleted documents

Posted by GitBox <gi...@apache.org>.
davisp commented on a change in pull request #3123:
URL: https://github.com/apache/couchdb/pull/3123#discussion_r481410760



##########
File path: src/fabric/test/fabric2_doc_crud_tests.erl
##########
@@ -449,12 +449,19 @@ conflict_on_update_with_no_rev({Db, _}) ->
     ?assertThrow(conflict, fabric2_db:update_doc(Db, Doc2)).
 
 
-conflict_on_create_as_deleted({Db, _}) ->
+allow_create_new_as_deleted({Db, _}) ->
     Doc = #doc{
         id = fabric2_util:uuid(),
         deleted = true,
         body = {[{<<"foo">>, <<"bar">>}]}
     },
+    {ok, {1, Rev}} = fabric2_db:update_doc(Db, Doc),
+    ?assertEqual({not_found, deleted}, fabric2_db:open_doc(Db, Doc#doc.id)),
+    Doc1 = Doc#doc{
+        revs = {1, [Rev]}
+    },
+    ?assertEqual({ok, Doc1}, fabric2_db:open_doc(Db, Doc#doc.id, [deleted])),
+    % Only works for new deleted documents

Review comment:
       Minor nit, but how about "Only works when the document has never existed to match CouchDB 3.x behavior"




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] nickva commented on pull request #3123: Allow creating new deleted documents

Posted by GitBox <gi...@apache.org>.
nickva commented on pull request #3123:
URL: https://github.com/apache/couchdb/pull/3123#issuecomment-686644481


   It looks like the ML discussion converged to maintain compatibility so merging the PR
   
   https://lists.apache.org/thread.html/r807a3179a9e1f62aefad6fc6f46183ea9a7d684f765228e975ef2857%40%3Cdev.couchdb.apache.org%3E
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] nickva commented on a change in pull request #3123: Allow creating new deleted documents

Posted by GitBox <gi...@apache.org>.
nickva commented on a change in pull request #3123:
URL: https://github.com/apache/couchdb/pull/3123#discussion_r481411019



##########
File path: src/fabric/test/fabric2_doc_crud_tests.erl
##########
@@ -449,12 +449,19 @@ conflict_on_update_with_no_rev({Db, _}) ->
     ?assertThrow(conflict, fabric2_db:update_doc(Db, Doc2)).
 
 
-conflict_on_create_as_deleted({Db, _}) ->
+allow_create_new_as_deleted({Db, _}) ->
     Doc = #doc{
         id = fabric2_util:uuid(),
         deleted = true,
         body = {[{<<"foo">>, <<"bar">>}]}
     },
+    {ok, {1, Rev}} = fabric2_db:update_doc(Db, Doc),
+    ?assertEqual({not_found, deleted}, fabric2_db:open_doc(Db, Doc#doc.id)),
+    Doc1 = Doc#doc{
+        revs = {1, [Rev]}
+    },
+    ?assertEqual({ok, Doc1}, fabric2_db:open_doc(Db, Doc#doc.id, [deleted])),
+    % Only works for new deleted documents

Review comment:
       That sounds better




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] nickva merged pull request #3123: Allow creating new deleted documents

Posted by GitBox <gi...@apache.org>.
nickva merged pull request #3123:
URL: https://github.com/apache/couchdb/pull/3123


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org