mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
Merge branch 'master' of github.com:mongodb/mongo
This commit is contained in:
commit
1e0bdddf44
@ -226,7 +226,7 @@ namespace mongo {
|
||||
if ( from.localhost() )
|
||||
return true;
|
||||
|
||||
if ( db.findOne( "admin.system.users" , BSONObj() ).isEmpty() )
|
||||
if ( db.findOne( "admin.system.users" , BSONObj() ).isEmpty() , 0 , QueryOption_SlaveOk )
|
||||
return true;
|
||||
|
||||
string auth = getHeader( rq , "Authorization" );
|
||||
|
@ -513,8 +513,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 ) );
|
||||
@ -701,7 +701,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;
|
||||
@ -729,6 +729,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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -697,10 +697,11 @@ namespace mongo {
|
||||
return;
|
||||
}
|
||||
BSONObj info;
|
||||
uassert( 13010, "whatsmyuri failed", c.runCommand( "admin", BSON( "whatsmyuri" << 1 ), info ) );
|
||||
// There's no way to explicitly disconnect a DBClientConnection, but we might allocate
|
||||
// a new uri on automatic reconnect. So just store one uri per connection.
|
||||
_allMyUris[ &c ] = info[ "you" ].str();
|
||||
if ( c.runCommand( "admin", BSON( "whatsmyuri" << 1 ), info ) ) {
|
||||
// There's no way to explicitly disconnect a DBClientConnection, but we might allocate
|
||||
// a new uri on automatic reconnect. So just store one uri per connection.
|
||||
_allMyUris[ &c ] = info[ "you" ].str();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace mongo {
|
||||
|
||||
void cell( stringstream& ss , string name , unsigned width , double val ){
|
||||
cellstart( ss , name , width );
|
||||
ss << setw(width) << val << " ";
|
||||
ss << setw(width) << setprecision(3) << val << " ";
|
||||
}
|
||||
|
||||
void cell( stringstream& ss , string name , unsigned width , int val ){
|
||||
|
Loading…
Reference in New Issue
Block a user