Permalink
Browse files

working.

  • Loading branch information...
1 parent 8b9da09 commit 01575fde2ce9d5c290f09b467849f19bde81422d Mathieu Poumeyrol committed Nov 3, 2011
Showing with 5 additions and 3 deletions.
  1. +3 −2 db/queryutil.cpp
  2. +2 −1 jstests/kali.js
View
@@ -430,6 +430,7 @@ namespace mongo {
lower = addObj( b.obj() ).firstElement();
}
}
+ cerr << toString() << "\n";
}
void FieldRange::finishOperation( const vector<FieldInterval> &newIntervals, const FieldRange &other ) {
@@ -464,7 +465,7 @@ namespace mongo {
}
const FieldRange &FieldRange::operator&=( const FieldRange &other ) {
- if ( !_singleKey && !_rangeHint && nontrivial() ) {
+ if ( !_singleKey && !_rangeHint && !other._rangeHint && nontrivial() ) {
if ( other <= *this ) {
*this = other;
}
@@ -648,7 +649,7 @@ namespace mongo {
string FieldRange::toString() const {
StringBuilder buf;
- buf << "(FieldRange special: " << _special << " singleKey: " << _special << " intervals: ";
+ buf << "(FieldRange special: " << _special << " singleKey: " << _singleKey << " rangeHint: " << _rangeHint << " intervals: ";
for( vector<FieldInterval>::const_iterator i = _intervals.begin(); i != _intervals.end(); ++i ) {
buf << i->toString();
}
View
@@ -3,7 +3,7 @@ db.test.save({ v: [ {a:1}, {a:4}, {a:8} ] })
db.test.ensureIndex({ "v.a" : 1 })
query = { "v" : { $elemMatch : { "a" : { "$gte" : 3, "$lte" : 5}}}};
-
+/*
plan = db.test.find(query).explain();
assert.eq([[3, 1.7976931348623157e+308]], plan.indexBounds["v.a"]);
@@ -15,6 +15,7 @@ assert.eq([[3, 1.7976931348623157e+308]], plan.indexBounds["v.a"]);
plan = db.test.find(query).hint({ $index : { "v.a" : 1 } }).explain();
assert.eq([[3, 1.7976931348623157e+308]], plan.indexBounds["v.a"]);
+*/
plan = db.test.find(query).hint({ $index : "v.a_1", $range : { "v.a" : true } }).explain();
assert.eq([[3, 5]], plan.indexBounds["v.a"]);

0 comments on commit 01575fd

Please sign in to comment.