summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r--src/mongo/db/dbhelpers.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 630c0093a91..7c1e045f497 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -138,7 +138,8 @@ bool Helpers::findById(OperationContext* opCtx,
bool* indexFound) {
invariant(database);
- Collection* collection = database->getCollection(opCtx, NamespaceString(ns));
+ Collection* collection =
+ CollectionCatalog::get(opCtx).lookupCollectionByNamespace(NamespaceString(ns));
if (!collection) {
return false;
}
@@ -262,7 +263,8 @@ BSONObj Helpers::inferKeyPattern(const BSONObj& o) {
void Helpers::emptyCollection(OperationContext* opCtx, const NamespaceString& nss) {
OldClientContext context(opCtx, nss.ns());
repl::UnreplicatedWritesBlock uwb(opCtx);
- Collection* collection = context.db() ? context.db()->getCollection(opCtx, nss) : nullptr;
+ Collection* collection =
+ context.db() ? CollectionCatalog::get(opCtx).lookupCollectionByNamespace(nss) : nullptr;
deleteObjects(opCtx, collection, nss, BSONObj(), false);
}