You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "ronnieroyston (via GitHub)" <gi...@apache.org> on 2023/06/20 01:11:16 UTC

[GitHub] [couchdb] ronnieroyston opened a new issue, #4649: Inaccurately Named Fields Returned In Response To Document Creation

ronnieroyston opened a new issue, #4649:
URL: https://github.com/apache/couchdb/issues/4649

   HTTP PUT a new document and the response body says, for example:
   
   ```
   {
     "ok": true,
     "id": "f70b5197-e649-4ce8-8cb4-a12c1126349a",
     "rev": "1-0ea20e4df4d321c40c82348dc83ddc56"
   }
   ```
   
   "id" is actually "_id" and "rev" is actually "_rev". Couch should respond with accurate field identifiers.


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

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org.apache.org

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


[GitHub] [couchdb] nickva commented on issue #4649: Inaccurately Named Fields Returned In Response To Document Creation

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on issue #4649:
URL: https://github.com/apache/couchdb/issues/4649#issuecomment-1598028192

   The response of a `PUT $db/$docid` or `POST $db` is not really a document, it's a just a json grouping of fields.
   
   The convention is used in the [_bulk_get](https://docs.couchdb.org/en/stable/api/database/bulk-api.html#db-bulk-get) endpoint as well: since we're not sending document bodies we use `id` and `rev` as is, without the `_` prefix.
   
   We can argue that it might have been better to use `_id` and `_rev` always but it seems a small enough difference that it's not worth breaking backward compatibility over.
   
   
   
   


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

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

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


[GitHub] [couchdb] ronnieroyston commented on issue #4649: Inaccurately Named Fields Returned In Response To Document Creation

Posted by "ronnieroyston (via GitHub)" <gi...@apache.org>.
ronnieroyston commented on issue #4649:
URL: https://github.com/apache/couchdb/issues/4649#issuecomment-1598030503

   You could return both, with `_` and without, so as to maintain backward compatability for a period of time; maybe with a warning message? The thing is, `_rev` is key to many operations against CouchDB.


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

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

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


[GitHub] [couchdb] rnewson commented on issue #4649: Inaccurately Named Fields Returned In Response To Document Creation

Posted by "rnewson (via GitHub)" <gi...@apache.org>.
rnewson commented on issue #4649:
URL: https://github.com/apache/couchdb/issues/4649#issuecomment-1617828335

   Hi Ronnie,
   
   The use of "id" versus "_id" in different places in the CouchDB api has been there since the beginning, and is intentional. We are not changing it, not least because users may have legitimatedly used "id" and "rev" properties in their bodies.
   
   The rule is simple, where user content _could_ appear, CouchDB uses underscore prefix (and prohibits users from doing so). Where it is unambiguous, in the example you cite or the "id" parameter in _all_docs response, we omit the underscore prefix.


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

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

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


[GitHub] [couchdb] rnewson closed issue #4649: Inaccurately Named Fields Returned In Response To Document Creation

Posted by "rnewson (via GitHub)" <gi...@apache.org>.
rnewson closed issue #4649: Inaccurately Named Fields Returned In Response To Document Creation
URL: https://github.com/apache/couchdb/issues/4649


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

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

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