mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
switch to FieldBoundSet
sorting on shardkey now works for all cases i believe
This commit is contained in:
parent
500f01c9a5
commit
1b028db7ab
@ -101,9 +101,9 @@ assert.eq( 3 , db.foo.find().sort( { num : -1 } )[0].num , "sharding query w/sor
|
||||
// TODO: sory by name
|
||||
|
||||
// sort by num multiple shards per server
|
||||
s.adminCommand( { split : "test.foo" , find : { num : 2 } } );
|
||||
s.adminCommand( { split : "test.foo" , middle : { num : 2 } } );
|
||||
assert.eq( "funny man" , db.foo.find().sort( { num : 1 } )[0].name , "sharding query w/sort and another split 1 order wrong" );
|
||||
assert.eq( "bob" , db.foo.find().sort( { num : -1 } )[0].name , "sharding query w/sort and another split 2 order wrong" );
|
||||
//assert.eq( "funny man" , db.foo.find( { num : { $lt : 100 } } ).sort( { num : 1 } ).arrayAccess(0).name , "sharding query w/sort and another split 3 order wrong" );
|
||||
assert.eq( "funny man" , db.foo.find( { num : { $lt : 100 } } ).sort( { num : 1 } ).arrayAccess(0).name , "sharding query w/sort and another split 3 order wrong" );
|
||||
|
||||
s.stop();
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "request.h"
|
||||
#include "../client/connpool.h"
|
||||
#include "../db/commands.h"
|
||||
#include "../db/queryutil.h"
|
||||
|
||||
namespace mongo {
|
||||
|
||||
@ -104,10 +105,16 @@ namespace mongo {
|
||||
}
|
||||
return b.obj();
|
||||
}
|
||||
|
||||
|
||||
BSONObj ShardedCursor::_concatFilter( const BSONObj& filter , const BSONObj& extra ){
|
||||
BSONObjBuilder b;
|
||||
b.appendElements( filter );
|
||||
b.appendElements( extra );
|
||||
|
||||
FieldBoundSet s( "wrong" , b.obj() );
|
||||
return s.simplifiedQuery();
|
||||
|
||||
/*
|
||||
{ // take things from filter
|
||||
BSONObjIterator i( filter );
|
||||
while ( i.more() ){
|
||||
@ -121,10 +128,11 @@ namespace mongo {
|
||||
}
|
||||
|
||||
BSONElement f = extra[e.fieldName()];
|
||||
|
||||
|
||||
uassert( "don't understand how filter couldn't be a range" , e.type() == Object );
|
||||
uassert( "don't understand how extra couldn't be a range" , f.type() == Object );
|
||||
|
||||
|
||||
|
||||
throw UserException( "can't handle a filter on a shard key yet: (" );
|
||||
}
|
||||
}
|
||||
@ -141,8 +149,9 @@ namespace mongo {
|
||||
b.append( e );
|
||||
}
|
||||
}
|
||||
|
||||
return b.obj();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void ShardedCursor::sendNextBatch( Request& r ){
|
||||
|
Loading…
Reference in New Issue
Block a user