don't query data from empty database

Change-Id: I82cc45092ca374065281def83548cf11c64d4c3d
Reviewed-on: http://review.couchbase.org/37146
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Li Yang <lichenyang2@gmail.com>