mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
callback for removeRange
This commit is contained in:
parent
2a65e81471
commit
f001dea20c
@ -241,7 +241,7 @@ namespace mongo {
|
||||
return me.obj();
|
||||
}
|
||||
|
||||
long long Helpers::removeRange( const string& ns , const BSONObj& min , const BSONObj& max , bool yield , bool maxInclusive ){
|
||||
long long Helpers::removeRange( const string& ns , const BSONObj& min , const BSONObj& max , bool yield , bool maxInclusive , RemoveCallback * callback ){
|
||||
BSONObj keya , keyb;
|
||||
BSONObj minClean = toKeyFormat( min , keya );
|
||||
BSONObj maxClean = toKeyFormat( max , keyb );
|
||||
@ -267,6 +267,9 @@ namespace mongo {
|
||||
DiskLoc rloc = c->currLoc();
|
||||
BSONObj key = c->currKey();
|
||||
|
||||
if ( callback )
|
||||
callback->goingToDelete( c->current() );
|
||||
|
||||
c->advance();
|
||||
c->noteLocation();
|
||||
|
||||
|
@ -117,7 +117,13 @@ namespace mongo {
|
||||
// TODO: this should be somewhere else probably
|
||||
static BSONObj toKeyFormat( const BSONObj& o , BSONObj& key );
|
||||
|
||||
static long long removeRange( const string& ns , const BSONObj& min , const BSONObj& max , bool yield = false , bool maxInclusive = false );
|
||||
class RemoveCallback {
|
||||
public:
|
||||
virtual ~RemoveCallback(){}
|
||||
virtual void goingToDelete( const BSONObj& o ) = 0;
|
||||
};
|
||||
|
||||
static long long removeRange( const string& ns , const BSONObj& min , const BSONObj& max , bool yield = false , bool maxInclusive = false , RemoveCallback * callback = 0 );
|
||||
|
||||
/* Remove all objects from a collection.
|
||||
You do not need to set the database before calling.
|
||||
|
Loading…
Reference in New Issue
Block a user