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 2018/01/12 09:05:26 UTC

[GitHub] wanginvc opened a new issue #70: Function db.get returns database information when empty docname provided

wanginvc opened a new issue #70: Function db.get returns database information when empty docname provided
URL: https://github.com/apache/couchdb-nano/issues/70
 
 
   Calling below function db.get with docname value either undefined, or, null, or empty string, it returns the information of db. 
   db.get(docname, [params], [callback])
   
   Result:
   { db_name: 'alice',
     update_seq: '9-g1AAAAEzeJzLYWBg4MhgTmHgzcvPy09JdcjLz8gvLskBCjMlMiTJ____PyuRAYeCJAUgmWQPVsOES40DSE08fnMSQGrq8arJYwGSDA1ACqhsPiF1CyDq9h 16         if(err) {
   NSdwCi7n5WIjtedQ8g6kDuywIAi4xi_w',
     sizes: { file: 70863, external: 1322, active: 3753 },
     purge_seq: 0,
     other: { data_size: 1322 },
     doc_del_count: 0,
     doc_count: 2,
     disk_size: 70863,
     disk_format_version: 6,
     data_size: 3753,
     compact_running: false,
     cluster: { q: 8, n: 1, w: 1, r: 1 },
     instance_start_time: '0' }
   
   ## Expected Behavior
   If docname is undefined, null, or empty string, the result should be an error like 404 not found. It makes developer hard to find the root cause if he made a mistake to pass docname with empty value.
   
   ## Current Behavior
   The database information is returned. 
   
   ## Possible Solution
   Check against the value of docname, and return error if it's undefined or null or ''.
   
   ## Steps to Reproduce (for bugs)
   db.get(undefined, [params], [callback]) or
   db.get(null, [params], [callback]) or 
   db.get('', [params], [callback])
   
   ## Context
   Developer make a mistake and "undefined" passed to docname. It takes time to locate this issue, because function "get" returned database information rather than an Error.
   
   ## Your Environment
   nano 6.4.2
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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