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 2019/10/03 11:15:35 UTC

[GitHub] [couchdb] vmatyusGitHub opened a new issue #2220: _bulk_docs batch deletion should require id, revision and deleted fields

vmatyusGitHub opened a new issue #2220: _bulk_docs batch deletion should require id, revision and deleted fields
URL: https://github.com/apache/couchdb/issues/2220
 
 
   [NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^ )
   
   ## Description
   
   [NOTE]: # ( Describe the problem you're encountering. )
   [TIP]:  # ( Do NOT give us access or passwords to your actual CouchDB! )
   
   Based on `_bulk_docs` endpoint documentation to delete a document, there is required to define _id, _rev and _deleted fields. So deletion should be executed, only when the request contains all the three required fields. But the current operation shows different behaviour.
   
   ## Steps to Reproduce
   If we give a new doc id with `_deleted` field - no revision is specified in the request, then a new document will be inserted into the CouchDB, whit `deleted: true` status.
   ```
   Request
   POST _bulk_docs
   {
     "docs": [
         {
            "_id": "test",
   	 "_deleted": true
          }
     ]
   }
   Response
   [
       {
           "ok": true,
           "id": "test",
           "rev": "1-de715bf126efc93d225d9e3f8e8eb81a"
       }
   ]
   ```
   If the  request contains only `_rev` and `_deleted` fields, then the server currently responds with 201 "conflict".
   
   If the request contains only `"_deleted": true` field, then the server will generate a new id and inject it into the DB, with status `deleted`.
   
   [NOTE]: # ( Include commands to reproduce, if possible. curl is preferred. )
   
   ## Expected Behaviour
   
   [NOTE]: # ( Tell us what you expected to happen. )
   It would be better to answer to these request with 400 `{"error": "bad_request", "reason": "<field_name> is required"}`. The reason field should expose which field was missing from the 3 required.
   
   ## Your Environment
   
   [TIP]:  # ( Include as many relevant details about your environment as possible. )
   [TIP]:  # ( You can paste the output of curl http://YOUR-COUCHDB:5984/ here. )
   
   * CouchDB Version used: 2.3.1
   * Browser name and version: PostMan
   * Operating System and version: macOS Majove 10.14.6 
   
   ## Additional context
   
   [TIP]:  # ( Add any other context about the prbolem here. )
   

----------------------------------------------------------------
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


With regards,
Apache Git Services