[couchdb] branch jenkins-freebsd updated (07dae5d -> 2486b1b)

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a change to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard 07dae5d  Add regression runs on new dedicated FreeBSD VM
 new 2486b1b  Add regression runs on new dedicated FreeBSD VM

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (07dae5d)
\
 N -- N -- N   refs/heads/jenkins-freebsd (2486b1b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Jenkinsfile | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)



[couchdb] 01/01: Add regression runs on new dedicated FreeBSD VM

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 2486b1bad9f3ef5ceb26c6f49a7e16c81af0e2f3
Author: Joan Touzet 
AuthorDate: Tue Jun 26 20:45:23 2018 -0400

Add regression runs on new dedicated FreeBSD VM

Thanks to Just Some Enterprises for donating the compute power!
---
 Jenkinsfile | 27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index b3cd975..7e8141c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,32 @@ pipeline {
 // Build packages on supported platforms using esl's erlang
 stage('Test') {
   steps {
-parallel(centos6: {
+parallel(freebsd: {
+  node(label: 'couchdb && freebsd') {
+timeout(time: 60, unit: "MINUTES") {
+  deleteDir()
+  unstash 'tarball'
+  withEnv(['HOME='+pwd()]) {
+sh '''
+  cwd=$(pwd)
+  mkdir -p $COUCHDB_IO_LOG_DIR
+  
+  # Build CouchDB from tarball & test
+  builddir=$(mktemp -d)
+  cd $builddir
+  tar -xf $cwd/apache-couchdb-*.tar.gz
+  cd apache-couchdb-*
+  ./configure --with-curl
+  gmake check || (build-aux/logfile-uploader.py && false)
+
+  # No package build for FreeBSD at this time
+'''
+  } // withEnv
+} // timeout
+deleteDir()
+  } // node
+},
+centos6: {
   node(label: 'ubuntu') {
 timeout(time: 60, unit: "MINUTES") {
   sh 'docker pull couchdbdev/centos-6-erlang-19.3.6'



[couchdb] branch jenkins-freebsd updated (fe93d1b -> 07dae5d)

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a change to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard fe93d1b  Add regression runs on new dedicated FreeBSD VM
 new 07dae5d  Add regression runs on new dedicated FreeBSD VM

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (fe93d1b)
\
 N -- N -- N   refs/heads/jenkins-freebsd (07dae5d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Jenkinsfile | 1 +
 1 file changed, 1 insertion(+)



[couchdb] 01/01: Add regression runs on new dedicated FreeBSD VM

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 07dae5d05a55bd4d72954d0e7d88eec39f2ce71f
Author: Joan Touzet 
AuthorDate: Tue Jun 26 20:45:23 2018 -0400

Add regression runs on new dedicated FreeBSD VM

Thanks to Just Some Enterprises for donating the compute power!
---
 Jenkinsfile | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index b3cd975..666d209 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,30 @@ pipeline {
 // Build packages on supported platforms using esl's erlang
 stage('Test') {
   steps {
-parallel(centos6: {
+parallel(freebsd: {
+  node(label: 'couchdb && freebsd') {
+timeout(time: 60, unit: "MINUTES") {
+  deleteDir()
+  unstash 'tarball'
+  sh '''
+cwd=$(pwd)
+mkdir -p $COUCHDB_IO_LOG_DIR
+
+# Build CouchDB from tarball & test
+builddir=$(mktemp -d)
+cd $builddir
+tar -xf $cwd/apache-couchdb-*.tar.gz
+cd apache-couchdb-*
+./configure --with-curl
+gmake check || (build-aux/logfile-uploader.py && false)
+
+# No package build for FreeBSD at this time
+  '''
+} // timeout
+deleteDir()
+  } // node
+},
+centos6: {
   node(label: 'ubuntu') {
 timeout(time: 60, unit: "MINUTES") {
   sh 'docker pull couchdbdev/centos-6-erlang-19.3.6'



[couchdb] branch jenkins-freebsd updated (8e0e444 -> fe93d1b)

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a change to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard 8e0e444  Add regression runs on new dedicated FreeBSD VM
 new fe93d1b  Add regression runs on new dedicated FreeBSD VM

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (8e0e444)
\
 N -- N -- N   refs/heads/jenkins-freebsd (fe93d1b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Jenkinsfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[couchdb] 01/01: Add regression runs on new dedicated FreeBSD VM

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit fe93d1bb14e319617d4326d52b7e39589deb9513
Author: Joan Touzet 
AuthorDate: Tue Jun 26 20:45:23 2018 -0400

Add regression runs on new dedicated FreeBSD VM

Thanks to Just Some Enterprises for donating the compute power!
---
 Jenkinsfile | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index b3cd975..b0aaa92 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,29 @@ pipeline {
 // Build packages on supported platforms using esl's erlang
 stage('Test') {
   steps {
-parallel(centos6: {
+parallel(freebsd: {
+  node(label: 'couchdb && freebsd') {
+timeout(time: 60, unit: "MINUTES") {
+  unstash 'tarball'
+  sh '''
+cwd=$(pwd)
+mkdir -p $COUCHDB_IO_LOG_DIR
+
+# Build CouchDB from tarball & test
+builddir=$(mktemp -d)
+cd $builddir
+tar -xf $cwd/apache-couchdb-*.tar.gz
+cd apache-couchdb-*
+./configure --with-curl
+gmake check || (build-aux/logfile-uploader.py && false)
+
+# No package build for FreeBSD at this time
+  '''
+} // timeout
+deleteDir()
+  } // node
+},
+centos6: {
   node(label: 'ubuntu') {
 timeout(time: 60, unit: "MINUTES") {
   sh 'docker pull couchdbdev/centos-6-erlang-19.3.6'



[couchdb] branch jenkins-freebsd updated (925c3cb -> 8e0e444)

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a change to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard 925c3cb  Add regression runs on new dedicated FreeBSD VM
 new 8e0e444  Add regression runs on new dedicated FreeBSD VM

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (925c3cb)
\
 N -- N -- N   refs/heads/jenkins-freebsd (8e0e444)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Jenkinsfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[couchdb] 01/01: Add regression runs on new dedicated FreeBSD VM

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8e0e4442ecfe3a1286e5a816e96ff483e3ae41bd
Author: Joan Touzet 
AuthorDate: Tue Jun 26 20:45:23 2018 -0400

Add regression runs on new dedicated FreeBSD VM

Thanks to Just Some Enterprises for donating the compute power!
---
 Jenkinsfile | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index b3cd975..b815dff 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,29 @@ pipeline {
 // Build packages on supported platforms using esl's erlang
 stage('Test') {
   steps {
-parallel(centos6: {
+parallel(freebsd: {
+  node(label: 'couchdb && freebsd') {
+timeout(time: 60, unit: "MINUTES") {
+  unstash 'tarball'
+  sh '''
+cwd=$(pwd)
+mkdir -p $COUCHDB_IO_LOG_DIR
+
+# Build CouchDB from tarball & test
+builddir=$(mktemp -d)
+cd $builddir
+tar -xf $cwd/apache-couchdb-*.tar.gz
+cd apache-couchdb-*
+./configure --with-curl
+make check || (build-aux/logfile-uploader.py && false)
+
+# No package build for FreeBSD at this time
+  '''
+} // timeout
+deleteDir()
+  } // node
+},
+centos6: {
   node(label: 'ubuntu') {
 timeout(time: 60, unit: "MINUTES") {
   sh 'docker pull couchdbdev/centos-6-erlang-19.3.6'



[couchdb] branch jenkins-freebsd created (now 925c3cb)

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a change to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


  at 925c3cb  Add regression runs on new dedicated FreeBSD VM

This branch includes the following new commits:

 new 925c3cb  Add regression runs on new dedicated FreeBSD VM

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[couchdb] 01/01: Add regression runs on new dedicated FreeBSD VM

2018-06-26 Thread wohali
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch jenkins-freebsd
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 925c3cb18b10e3e540414b7b4907c4c3e5cd7d3f
Author: Joan Touzet 
AuthorDate: Tue Jun 26 20:45:23 2018 -0400

Add regression runs on new dedicated FreeBSD VM

Thanks to Just Some Enterprises for donating the compute power!
---
 Jenkinsfile | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/Jenkinsfile b/Jenkinsfile
index b3cd975..bbd7b38 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,6 +78,28 @@ pipeline {
 // Build packages on supported platforms using esl's erlang
 stage('Test') {
   steps {
+parallel(freebsd: {
+  node(label: 'couchdb && freebsd') {
+timeout(time: 60, unit: "MINUTES") {
+  unstash 'tarball'
+  sh '''
+cwd=$(pwd)
+mkdir -p $COUCHDB_IO_LOG_DIR
+
+# Build CouchDB from tarball & test
+builddir=$(mktemp -d)
+cd $builddir
+tar -xf $cwd/apache-couchdb-*.tar.gz
+cd apache-couchdb-*
+./configure --with-curl
+make check || (build-aux/logfile-uploader.py && false)
+
+# No package build for FreeBSD at this time
+  '''
+} // timeout
+deleteDir()
+  } // node
+},
 parallel(centos6: {
   node(label: 'ubuntu') {
 timeout(time: 60, unit: "MINUTES") {



[couchdb] branch COUCHDB-3326-clustered-purge-pr5-implementation updated: Set limit for Ids and total Revs in one purge req

2018-06-26 Thread jiangphcn
This is an automated email from the ASF dual-hosted git repository.

jiangphcn pushed a commit to branch 
COUCHDB-3326-clustered-purge-pr5-implementation
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to 
refs/heads/COUCHDB-3326-clustered-purge-pr5-implementation by this push:
 new d3d66c9  Set limit for Ids and total Revs in one purge req
d3d66c9 is described below

commit d3d66c94bfa7c9d84b8c8ea566798c0b001ecc46
Author: jiangphcn 
AuthorDate: Tue Jun 26 23:02:06 2018 +0800

Set limit for Ids and total Revs in one purge req

COUCHDB-3326
---
 src/chttpd/src/chttpd_db.erl   | 13 +
 src/chttpd/test/chttpd_purge_tests.erl | 53 +-
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 83375cd..cbdb641 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -502,6 +502,19 @@ 
db_req(#httpd{method='POST',path_parts=[_,<<"_purge">>]}=Req, Db) ->
 Options = [{user_ctx, Req#httpd.user_ctx}, {w, W}],
 {IdsRevs} = chttpd:json_body_obj(Req),
 IdsRevs2 = [{Id, couch_doc:parse_revs(Revs)} || {Id, Revs} <- IdsRevs],
+MaxIds = config:get_integer("purge", "max_document_id_number", 100),
+case length(IdsRevs2) =< MaxIds of
+false -> throw({bad_request, "Document numbers larger than expected"});
+true -> ok
+end,
+RevsLen = lists:foldl(fun({_Id, Revs}, Acc) ->
+length(Revs) + Acc
+end, 0, IdsRevs2),
+MaxRevs = config:get_integer("purge", "max_revisions_number", 1000),
+case RevsLen =< MaxRevs of
+false -> throw({bad_request, "Document revs larger than expected"});
+true -> ok
+end,
 {ok, Results} = fabric:purge_docs(Db, IdsRevs2, Options),
 {Code, Json} = purge_results_to_json(IdsRevs2, Results),
 send_json(Req, Code, {[{<<"purge_seq">>, null}, {<<"purged">>, {Json}}]});
diff --git a/src/chttpd/test/chttpd_purge_tests.erl 
b/src/chttpd/test/chttpd_purge_tests.erl
index 04456cb..2b06b2a 100644
--- a/src/chttpd/test/chttpd_purge_tests.erl
+++ b/src/chttpd/test/chttpd_purge_tests.erl
@@ -72,6 +72,7 @@ purge_test_() ->
 fun test_ok_purge_request/1,
 fun test_partial_purge_request/1,
 fun test_mixed_purge_request/1,
+fun test_overmany_ids_or_revs_purge_request/1,
 fun test_exceed_limits_on_purge_infos/1,
 fun should_error_set_purged_docs_limit_to0/1
 ]
@@ -190,7 +191,7 @@ test_mixed_purge_request(Url) ->
 
 IdsRevsEJson = {[
 {<<"doc1">>, [Rev1]},  % partial purge
-{<<"doc2">>, [Rev3]},  % correct format, but invalid rev
+{<<"doc2">>, [Rev3, Rev1]},  % correct format, but invalid rev
 {<<"doc3">>, [Rev3]}   % correct format and rev
 ]},
 IdsRevs = binary_to_list(?JSON_ENCODE(IdsRevsEJson)),
@@ -218,6 +219,56 @@ test_mixed_purge_request(Url) ->
 end).
 
 
+test_overmany_ids_or_revs_purge_request(Url) ->
+?_test(begin
+{ok, _, _, Body} = create_doc(Url, "doc1"),
+{Json} = ?JSON_DECODE(Body),
+Rev1 = couch_util:get_value(<<"rev">>, Json, undefined),
+
+NewDoc = "{\"new_edits\": false, \"docs\": [{\"_id\": \"doc1\",
+\"_revisions\": {\"start\": 1, \"ids\": [\"12345\", \"67890\"]},
+\"content\": \"updated\", \"_rev\": \"" ++ ?b2l(Rev1) ++ "\"}]}",
+{ok, _, _, _} = test_request:post(Url ++ "/_bulk_docs/",
+[?CONTENT_JSON, ?AUTH], NewDoc),
+
+{ok, _, _, _Body2} = create_doc(Url, "doc2", "content2"),
+{ok, _, _, Body3} = create_doc(Url, "doc3", "content3"),
+{Json3} = ?JSON_DECODE(Body3),
+Rev3 = couch_util:get_value(<<"rev">>, Json3, undefined),
+
+IdsRevsEJson = {[
+{<<"doc1">>, [Rev1]},  % partial purge
+{<<"doc2">>, [Rev3, Rev1]},  % correct format, but invalid rev
+{<<"doc3">>, [Rev3]}   % correct format and rev
+]},
+IdsRevs = binary_to_list(?JSON_ENCODE(IdsRevsEJson)),
+
+% Ids larger than expected
+config:set("purge", "max_document_id_number", "1"),
+{ok, Status, _, Body4} = test_request:post(Url ++ "/_purge/",
+[?CONTENT_JSON, ?AUTH], IdsRevs),
+config:delete("purge", "max_document_id_number"),
+ResultJson = ?JSON_DECODE(Body4),
+?assertEqual(400, Status),
+?assertMatch({[
+{<<"error">>,<<"bad_request">>},
+{<<"reason">>,<<"Document numbers larger than expected">>}]},
+ResultJson),
+
+% Revs larger than expected
+config:set("purge", "max_revisions_number", "1"),
+{ok, Status2, _, Body5} = test_request:post(Url ++ "/_purge/",
+[?CONTENT_JSON, ?AUTH], IdsRevs),
+config:delete("purge", 

[couchdb-nano] branch master updated: Fix in README name of the returned array when using uuids function (#90)

2018-06-26 Thread glynnbird
This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git


The following commit(s) were added to refs/heads/master by this push:
 new dcfdd16  Fix in README name of the returned array when using uuids 
function (#90)
dcfdd16 is described below

commit dcfdd16e50ef74e5055de305cf4f1dd4c47333ee
Author: Piotr Zarzycki 
AuthorDate: Tue Jun 26 08:57:16 2018 +0200

Fix in README name of the returned array when using uuids function (#90)
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index fa886f9..c7f7ff0 100644
--- a/README.md
+++ b/README.md
@@ -929,7 +929,7 @@ If your application needs to generate UUIDs, then CouchDB 
can provide some for y
 
 ```js
 nano.uuids(3, callback);
-// { uuid: [
+// { uuids: [
 // '5d1b3ef2bc7eea51f660c091e3dffa23',
 // '5d1b3ef2bc7eea51f660c091e3e006ff',
 // '5d1b3ef2bc7eea51f660c091e3e007f0',



[couchdb-nano] branch master updated: Update link to CouchDB bulk API documentation (#91)

2018-06-26 Thread glynnbird
This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git


The following commit(s) were added to refs/heads/master by this push:
 new bd9a10f  Update link to CouchDB bulk API documentation (#91)
bd9a10f is described below

commit bd9a10f331343aa0014571b618d62f48ef5a2a2a
Author: Thomas Toye 
AuthorDate: Tue Jun 26 08:56:39 2018 +0200

Update link to CouchDB bulk API documentation (#91)

Old link was dead
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 76ef6eb..fa886f9 100644
--- a/README.md
+++ b/README.md
@@ -557,7 +557,7 @@ alice.copy('rabbit', 'rabbit2', { overwrite: true }, 
function(err, _, headers) {
 ### db.bulk(docs, [params], [callback])
 
 Bulk operations(update/delete/insert) on the database, refer to the
-[CouchDB doc](http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API) e.g:
+[CouchDB 
doc](http://docs.couchdb.org/en/2.1.1/api/database/bulk-api.html#db-bulk-docs) 
e.g:
 
 ``` js
 var documents = [



[couchdb-nano] branch master updated: (#70) Return error if db.get() called with no docName (#78)

2018-06-26 Thread glynnbird
This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git


The following commit(s) were added to refs/heads/master by this push:
 new 723e148  (#70) Return error if db.get() called with no docName (#78)
723e148 is described below

commit 723e148f1633c5a75c78c62fd5ff4914ea01d560
Author: Adam Saeid <20905824+adamsa...@users.noreply.github.com>
AuthorDate: Tue Jun 26 07:55:52 2018 +0100

(#70) Return error if db.get() called with no docName (#78)
---
 lib/nano.js|  8 +++-
 tests/unit/document/get.js | 41 +
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/lib/nano.js b/lib/nano.js
index 3b7f822..0ea96de 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -460,7 +460,13 @@ module.exports = exports = nano = function dbScope(cfg) {
 qs = {};
   }
 
-  return relax({db: dbName, doc: docName, qs: qs}, callback);
+  if(!docName) {
+if(callback)
+  callback("Invalid doc id", null);
+  }
+  else {
+return relax({db: dbName, doc: docName, qs: qs}, callback);
+  }
 }
 
 // 
http://docs.couchdb.org/en/latest/api/document/common.html#head--db-docid
diff --git a/tests/unit/document/get.js b/tests/unit/document/get.js
new file mode 100644
index 000..bbe18b7
--- /dev/null
+++ b/tests/unit/document/get.js
@@ -0,0 +1,41 @@
+// Licensed under the Apache License, Version 2.0 (the 'License'); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
+'use strict';
+
+var helpers = require('../../helpers/unit');
+var test  = require('tape');
+var debug = require('debug')('nano/tests/unit/shared/error');
+
+var cli = helpers.mockClientDb(debug)
+var db = cli.use('foo')
+
+test('it should not return db info if docName undefined', function(assert) {
+  db.get(undefined, function(err) {
+assert.equal(err, 'Invalid doc id');
+assert.end();
+  });
+});
+
+test('it should not return db info if docName null', function(assert) {
+  db.get(null, function(err) {
+assert.equal(err, 'Invalid doc id');
+assert.end();
+  });
+});
+
+test('it should not return db info if docName empty string', function(assert) {
+  db.get('', function(err) {
+assert.equal(err, 'Invalid doc id');
+assert.end();
+  });
+});
\ No newline at end of file