summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/s2_access_method.cpp
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2013-05-15 09:50:08 -0400
committerGreg Studer <greg@10gen.com>2013-05-15 09:50:27 -0400
commitf965235efa02833d8055013525ff0433567e0d95 (patch)
treeadb71f539f1f2aba266e58b562126d0f255190cd /src/mongo/db/index/s2_access_method.cpp
parentf1f5a9538290d0a9e1831da34b70016a2774b40b (diff)
downloadmongo-f965235efa02833d8055013525ff0433567e0d95.tar.gz
SERVER-9647 don't transform 2dsphere desc fields into asc
Diffstat (limited to 'src/mongo/db/index/s2_access_method.cpp')
-rw-r--r--src/mongo/db/index/s2_access_method.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/index/s2_access_method.cpp b/src/mongo/db/index/s2_access_method.cpp
index ca4fc60d2c8..c43ecc75964 100644
--- a/src/mongo/db/index/s2_access_method.cpp
+++ b/src/mongo/db/index/s2_access_method.cpp
@@ -73,13 +73,20 @@ namespace mongo {
_params.finestIndexedLevel >= _params.coarsestIndexedLevel);
int geoFields = 0;
+
// Categorize the fields we're indexing and make sure we have a geo field.
BSONObjIterator i(descriptor->keyPattern());
while (i.more()) {
BSONElement e = i.next();
- if (e.type() == String && IndexNames::GEO_2DSPHERE == e.valuestr()) {
+ if (e.type() == String && IndexNames::GEO_2DSPHERE == e.String() ) {
++geoFields;
}
+ else {
+ // We check for numeric in 2d, so that's the check here
+ uassert( 16823, (string)"Cannot use " + IndexNames::GEO_2DSPHERE +
+ " index with other special index types: " + e.toString(),
+ e.isNumber() );
+ }
}
uassert(16750, "Expect at least one geo field, spec=" + descriptor->keyPattern().toString(),
geoFields >= 1);