summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/s2_access_method.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-10-24 12:08:41 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-10-24 12:08:41 -0400
commit6332ae304a743abf86d47d92c12bf7f3f2169368 (patch)
treeaa3d166372650e3cff6454ec7086ea568d65e555 /src/mongo/db/index/s2_access_method.cpp
parentc3019ad939da94e44689c49a92a86b357b8c2596 (diff)
downloadmongo-6332ae304a743abf86d47d92c12bf7f3f2169368.tar.gz
SERVER-11149 2dsphere handle sparse like other indices
Diffstat (limited to 'src/mongo/db/index/s2_access_method.cpp')
-rw-r--r--src/mongo/db/index/s2_access_method.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/index/s2_access_method.cpp b/src/mongo/db/index/s2_access_method.cpp
index ebab9df183c..64cfd4cef55 100644
--- a/src/mongo/db/index/s2_access_method.cpp
+++ b/src/mongo/db/index/s2_access_method.cpp
@@ -102,11 +102,11 @@ namespace mongo {
// false means Don't expand the last array, duh.
obj.getFieldsDotted(e.fieldName(), fieldElements, false);
+ // If we're sparse and we're missing any field, bail out.
+ if (_descriptor->isSparse() && fieldElements.empty()) { return; }
+
BSONObjSet keysForThisField;
if (IndexNames::GEO_2DSPHERE == e.valuestr()) {
- // We can't ever return documents that don't have geometry so don't bother indexing
- // them.
- if (fieldElements.empty()) { return; }
getGeoKeys(obj, fieldElements, &keysForThisField);
} else {
getLiteralKeys(fieldElements, &keysForThisField);