summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/dbhash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/dbhash.cpp')
-rw-r--r--src/mongo/db/commands/dbhash.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 442c3fe728d..2eaadf286d2 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -61,6 +61,8 @@ namespace mongo {
namespace {
+constexpr char SKIP_TEMP_COLLECTION[] = "skipTempCollections";
+
class DBHashCmd : public BasicCommand {
public:
DBHashCmd() : BasicCommand("dbHash", "dbhash") {}
@@ -136,6 +138,12 @@ public:
}
}
+ const bool skipTempCollections =
+ cmdObj.hasField(SKIP_TEMP_COLLECTION) && cmdObj[SKIP_TEMP_COLLECTION].trueValue();
+ if (skipTempCollections) {
+ LOGV2(6859700, "Skipping hash computation for temporary collections");
+ }
+
// For empty databasename on first command field, the following code depends on the "."
// on ns to find the invalid empty db name instead of checking empty db name directly.
const std::string ns = parseNs(dbName, cmdObj).ns();
@@ -256,6 +264,10 @@ public:
return true;
}
+ if (skipTempCollections && collection->isTemporary()) {
+ return true;
+ }
+
if (desiredCollections.size() > 0 &&
desiredCollections.count(collNss.coll().toString()) == 0)
return true;