Skip to content

Commit

Permalink
Rename delete variables to justOne and foundAllResults.
Browse files Browse the repository at this point in the history
  • Loading branch information
astaple committed May 13, 2012
1 parent dff8cd5 commit 1a51bec
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/mongo/db/ops/delete.cpp
Expand Up @@ -29,7 +29,7 @@ namespace mongo {
justOne: stop after 1 match
god: allow access to system namespaces, and don't yield
*/
long long deleteObjects(const char *ns, BSONObj pattern, bool justOneOrig, bool logop, bool god, RemoveSaver * rs ) {
long long deleteObjects(const char *ns, BSONObj pattern, bool justOne, bool logop, bool god, RemoveSaver * rs ) {
if( !god ) {
if ( strstr(ns, ".system.") ) {
/* note a delete from system.indexes would corrupt the db
Expand Down Expand Up @@ -64,7 +64,6 @@ namespace mongo {

CursorId id = cc->cursorid();

bool justOne = justOneOrig;
bool canYield = !god && !(creal->matcher() && creal->matcher()->docMatcher().atomic());

do {
Expand Down Expand Up @@ -108,11 +107,9 @@ namespace mongo {
cc->advance();
}

if ( !cc->ok() ) {
justOne = true;
}
bool foundAllResults = ( justOne || !cc->ok() );

if ( !justOne ) {
if ( !foundAllResults ) {
/* NOTE: this is SLOW. this is not good, noteLocation() was designed to be called across getMore
blocks. here we might call millions of times which would be bad.
*/
Expand All @@ -137,7 +134,7 @@ namespace mongo {

theDataFileMgr.deleteRecord(ns, rloc.rec(), rloc);
nDeleted++;
if ( justOne ) {
if ( foundAllResults ) {
break;
}
cc->c()->recoverFromTouchingEarlierIterate();
Expand Down

0 comments on commit 1a51bec

Please sign in to comment.