diff --git a/packages/node_modules/pouchdb-find/src/adapters/local/utils.js b/packages/node_modules/pouchdb-find/src/adapters/local/utils.js
index f97d21cf52..219a948911 100644
--- a/packages/node_modules/pouchdb-find/src/adapters/local/utils.js
+++ b/packages/node_modules/pouchdb-find/src/adapters/local/utils.js
@@ -75,6 +75,16 @@ function filterInclusiveStart(rows, targetValue, index) {
docKey.pop();
}
}
+ // docs missing the indexed field are excluded from the index entirely
+ // to avoid a null pointer exception in collate.
+ var isMissingKey = Array.isArray(docKey) ?
+ docKey.some(function (k) { return k === undefined; }) :
+ docKey === undefined;
+ if (isMissingKey) {
+ ++startAt;
+ continue;
+ }
+
//ABS as we just looking for values that don't match
if (Math.abs(collate(docKey, targetValue)) > 0) {
// no need to filter any further; we're past the key
diff --git a/tests/find/index.html b/tests/find/index.html
index 1566612eb0..c8dd4460be 100644
--- a/tests/find/index.html
+++ b/tests/find/index.html
@@ -60,6 +60,7 @@
+