diff options
author | James Wahlin <james.wahlin@10gen.com> | 2016-07-15 08:47:56 -0400 |
---|---|---|
committer | James Wahlin <james.wahlin@10gen.com> | 2016-07-15 14:00:40 -0400 |
commit | bfa627513c781c9e61b25dcf993fcd01aaeed0c3 (patch) | |
tree | 9489436b4a332a349e75f982426a5e9ccdfc533d /jstests/hooks | |
parent | e39a2a87eaca8a573b8b1145cf520415904019f5 (diff) | |
download | mongo-bfa627513c781c9e61b25dcf993fcd01aaeed0c3.tar.gz |
SERVER-24506 listCollections support for views
Diffstat (limited to 'jstests/hooks')
-rw-r--r-- | jstests/hooks/validate_collections.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/jstests/hooks/validate_collections.js b/jstests/hooks/validate_collections.js index 5024460f05a..946a0663894 100644 --- a/jstests/hooks/validate_collections.js +++ b/jstests/hooks/validate_collections.js @@ -20,9 +20,14 @@ function validateCollections(db, obj) { var full = obj.full; var success = true; - var collNames = db.getCollectionNames(); - for (var collName of collNames) { - var coll = db.getCollection(collName); + + // Don't run validate on view namespaces. + let listCollectionsRes = db.runCommand({listCollections: 1, filter: {"type": "collection"}}); + assert.commandWorked(listCollectionsRes); + let collInfo = new DBCommandCursor(db.getMongo(), listCollectionsRes).toArray(); + + for (var collDocument of collInfo) { + var coll = db.getCollection(collDocument["name"]); var res = coll.validate(full); if (!res.ok || !res.valid) { |