diff options
Diffstat (limited to 'src/mongo/db/catalog/collection_catalog_helper.cpp')
-rw-r--r-- | src/mongo/db/catalog/collection_catalog_helper.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/collection_catalog_helper.cpp b/src/mongo/db/catalog/collection_catalog_helper.cpp index 34b6ce992e1..7719ef531d1 100644 --- a/src/mongo/db/catalog/collection_catalog_helper.cpp +++ b/src/mongo/db/catalog/collection_catalog_helper.cpp @@ -36,15 +36,19 @@ namespace mongo { namespace catalog { -void forEachCollectionFromDb( - OperationContext* opCtx, - StringData dbName, - LockMode collLockMode, - std::function<bool(Collection* collection, CollectionCatalogEntry* catalogEntry)> callback) { +void forEachCollectionFromDb(OperationContext* opCtx, + StringData dbName, + LockMode collLockMode, + CollectionCatalog::CollectionInfoFn callback, + CollectionCatalog::CollectionInfoFn predicate) { CollectionCatalog& catalog = CollectionCatalog::get(opCtx); for (auto collectionIt = catalog.begin(dbName); collectionIt != catalog.end(); ++collectionIt) { auto uuid = collectionIt.uuid().get(); + if (predicate && !catalog.checkIfCollectionSatisfiable(uuid, predicate)) { + continue; + } + auto nss = catalog.lookupNSSByUUID(uuid); // If the NamespaceString can't be resolved from the uuid, then the collection was dropped. |