summaryrefslogtreecommitdiff
path: root/jstests/hooks/validate_collections.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/hooks/validate_collections.js')
-rw-r--r--jstests/hooks/validate_collections.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/jstests/hooks/validate_collections.js b/jstests/hooks/validate_collections.js
index 69085b8a1d6..9f4a9e8fc5f 100644
--- a/jstests/hooks/validate_collections.js
+++ b/jstests/hooks/validate_collections.js
@@ -43,9 +43,11 @@ function CollectionValidator() {
jsTest.options().skipValidationNamespaces.length > 0) {
let skippedCollections = [];
for (let ns of jsTest.options().skipValidationNamespaces) {
- // Strip off the database name from 'ns' to extract the collName.
+ // Attempt to strip the name of the database we are about to validate off of the
+ // namespace we wish to skip. If the replace() function does find a match with the
+ // database, then we know that the collection we want to skip is in the database we
+ // are about to validate. We will then put it in the 'filter' for later use.
const collName = ns.replace(new RegExp('^' + db.getName() + '\.'), '');
- // Skip the collection 'collName' if the db name was removed from 'ns'.
if (collName !== ns) {
skippedCollections.push({name: {$ne: collName}});
}