diff options
Diffstat (limited to 'src/mongo/db/exec/delete.cpp')
-rw-r--r-- | src/mongo/db/exec/delete.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp index d7e689e62f6..b8c4b8c0d93 100644 --- a/src/mongo/db/exec/delete.cpp +++ b/src/mongo/db/exec/delete.cpp @@ -100,20 +100,25 @@ namespace mongo { const bool deleteCappedOK = false; const bool deleteNoWarn = false; - _collection->deleteDocument(_txn, rloc, deleteCappedOK, deleteNoWarn, - _params.shouldCallLogOp ? &deletedDoc : NULL); - if (_params.shouldCallLogOp) { - if (deletedDoc.isEmpty()) { - log() << "Deleted object without id in collection " << _collection->ns() - << ", not logging."; - } - else { - bool replJustOne = true; - repl::logOp(_txn, "d", _collection->ns().ns().c_str(), deletedDoc, 0, - &replJustOne, _params.fromMigrate); + // Do the write, unless this is an explain. + if (!_params.isExplain) { + _collection->deleteDocument(_txn, rloc, deleteCappedOK, deleteNoWarn, + _params.shouldCallLogOp ? &deletedDoc : NULL); + + if (_params.shouldCallLogOp) { + if (deletedDoc.isEmpty()) { + log() << "Deleted object without id in collection " << _collection->ns() + << ", not logging."; + } + else { + bool replJustOne = true; + repl::logOp(_txn, "d", _collection->ns().ns().c_str(), deletedDoc, 0, + &replJustOne, _params.fromMigrate); + } } } + wunit.commit(); } |