Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

when using a special index, don't record because may screw up later S…

…ERVER-1669
  • Loading branch information...
commit 65078c15cbbc4f4ca44a25eda7d619abd37ee447 1 parent fcd1774
@erh erh authored
Showing with 28 additions and 1 deletion.
  1. +1 −1  db/queryoptimizer.cpp
  2. +27 −0 jstests/geo_queryoptimizer.js
View
2  db/queryoptimizer.cpp
@@ -362,7 +362,7 @@ namespace mongo {
const IndexSpec& spec = ii.getSpec();
if ( spec.getTypeName() == _special && spec.suitability( _originalQuery , order_ ) ){
usingPrerecordedPlan_ = true;
- mayRecordPlan_ = true;
+ mayRecordPlan_ = false;
plans_.push_back( PlanPtr( new QueryPlan( d , j , *fbs_ , _originalQuery, order_ ,
BSONObj() , BSONObj() , _special ) ) );
return;
View
27 jstests/geo_queryoptimizer.js
@@ -0,0 +1,27 @@
+
+t = db.geo_qo1;
+t.drop()
+
+t.ensureIndex({loc:"2d"})
+
+t.insert({'issue':0})
+t.insert({'issue':1})
+t.insert({'issue':2})
+t.insert({'issue':2, 'loc':[30.12,-118]})
+t.insert({'issue':1, 'loc':[30.12,-118]})
+t.insert({'issue':0, 'loc':[30.12,-118]})
+
+assert.eq( 6 , t.find().itcount() , "A1" )
+
+assert.eq( 2 , t.find({'issue':0}).itcount() , "A2" )
+
+assert.eq( 1 , t.find({'issue':0,'loc':{$near:[30.12,-118]}}).itcount() , "A3" )
+
+assert.eq( 2 , t.find({'issue':0}).itcount() , "B1" )
+
+assert.eq( 6 , t.find().itcount() , "B2" )
+
+assert.eq( 2 , t.find({'issue':0}).itcount() , "B3" )
+
+assert.eq( 1 , t.find({'issue':0,'loc':{$near:[30.12,-118]}}).itcount() , "B4" )
+
Please sign in to comment.
Something went wrong with that request. Please try again.