Complete issue #116

Port
https://github.com/couchbase/couchbase-lite-java-core/commit/4b063f13a78
c461ac5e8dfa57f6bed4563eebabd
Merge pull request #133 from couchbaselabs/issue-116

Complete issue #116