m-lukas opened a new issue #165: Misleading example value for docname in 
Attachments functions
URL: https://github.com/apache/couchdb-nano/issues/165
 
 
   <!--- Provide a general summary of the issue in the Title above -->
   
   ## Expected Behavior
   <!--- If you're describing a bug, tell us what should happen -->
   <!--- If you're suggesting a change/improvement, tell us how it should work 
-->
   
   From the examples, you should directly understand what is meant with the 
team "docname".
   In this case it's just the id of the document and the example should be 
choosen to understand that immediately. In best case there is additionally an 
definition for docname in general to cause no confusions.
   
   ## Current Behavior
   <!--- If describing a bug, tell us what happens instead of the expected 
behavior -->
   <!--- If suggesting a change/improvement, explain the difference from 
current behavior -->
   
   In the example for the attachment insert:
   ```
   const fs = require('fs');
   
   fs.readFile('rabbit.png', (err, data) => {
     if (!err) {
       alice.attachment.insert('rabbit', 'rabbit.png', data, 'image/png',
         { rev: '12-150985a725ec88be471921a54ce91452' }).then((body) => {
           console.log(body);
       });
     }
   });
   ```
   it uses rabbit as docname, similar to the filename.
   However since there is no definition for docname in general and the _id 
fields in my database are mostly hashes, I as complete beginner with CouchDB 
didn't realize that 'rabbit' is the _id of document but instead thought it's an 
shorter identifier? for the file. This caused an 409 error with the error 
message *"missing_rev"* (rev was existing parameter) which was quite 
missleading and it took me several hours to find the mistake.
   There is also a similar Issue #15 .
   
   ## Possible Solution
   <!--- Not obligatory, but suggest a fix/reason for the bug, -->
   <!--- or ideas how to implement the addition or change -->
   
   I think it would be helpful to specify more what docname means (for example 
add a short definition at the beginning of the README). Additionally it would 
be helpful to change the docname 'rabbit' to something different in this 
example. 
   
   ## Steps to Reproduce (for bugs)
   <!--- Provide a link to a live example, or an unambiguous set of steps to -->
   <!--- reproduce this bug. Include code to reproduce, if relevant -->
   
   
https://github.com/apache/couchdb-nano#dbattachmentinsertdocname-attname-att-contenttype-params-callback
   
   The error can be triggered by using a non-existing docname.
   
   ## Context
   <!--- How has this issue affected you? What are you trying to accomplish? -->
   <!--- Providing context helps us come up with a solution that is most useful 
in the real world -->
   
   I wanted to insert an attachment in my couchDB instance but used a 
non-existing docname (filename without mime type).

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to