0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

can't use "near" as a var on widnows

This commit is contained in:
Dwight 2010-02-23 15:57:59 -05:00
parent 799d462346
commit 7e6790bf3b
2 changed files with 11 additions and 4 deletions

View File

@ -498,8 +498,8 @@ namespace mongo {
public:
typedef multiset<GeoPoint> Holder;
GeoHopper( Geo2dType * g , unsigned max , const GeoHash& near , const BSONObj& filter = BSONObj() )
: _g( g ) , _max( max ) , _near( near ) , _lookedAt(0) , _objectsLoaded(0){
GeoHopper( Geo2dType * g , unsigned max , const GeoHash& n , const BSONObj& filter = BSONObj() )
: _g( g ) , _max( max ) , _near( n ) , _lookedAt(0) , _objectsLoaded(0){
if ( ! filter.isEmpty() )
_matcher.reset( new CoveredIndexMatcher( filter , g->_spec->keyPattern ) );
@ -686,7 +686,7 @@ namespace mongo {
GeoHash start = n;
if ( cmdObj["start"].type() == String){
start = (string)cmdObj["start"].valuestr();
start = (string) cmdObj["start"].valuestr();
if ( 2 * ( start.size() / 2 ) != start.size() ){
errmsg = "start has to be an even size";
return false;
@ -714,6 +714,8 @@ namespace mongo {
if ( cmdObj["query"].type() == Object )
filter = cmdObj["query"].embeddedObject();
//cout << "--------- GeoHopper " << n._hash << endl;
GeoHopper hopper( g , numWanted , n , filter );
GeoHash prefix = start;

View File

@ -9,15 +9,20 @@ for ( var x=-100; x<100; x+=2 ){
}
}
t.ensureIndex( { loc : "2d" } )
fast = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 } );
//printjson( fast.stats );
slow = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 , start : "11" } );
//printjson( slow.stats );
assert.lt( fast.stats.nscanned * 10 , slow.stats.nscanned , "A1" );
assert.lt( fast.stats.objectsLoaded , slow.stats.objectsLoaded , "A2" );
assert.eq( fast.stats.avgDistance , slow.stats.avgDistance , "A3" );
//printjson( fast.stats );
// test filter