summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.cpp
diff options
context:
space:
mode:
authorEvgeni Dobranov <evgeni.dobranov@mongodb.com>2019-09-30 20:02:19 +0000
committerevergreen <evergreen@mongodb.com>2019-09-30 20:02:19 +0000
commit344e1b0f3ce5caf0d4760dddc8b2d196d4b73fe8 (patch)
tree14567c05e50661f6fb3b983a2b19a26abfe4a22c /src/mongo/db/dbhelpers.cpp
parent25b63d9ff12ebdfde549288ebaa7ff27c6945dd7 (diff)
downloadmongo-344e1b0f3ce5caf0d4760dddc8b2d196d4b73fe8.tar.gz
SERVER-41496 Remove Database::getCollection() and replace with CollectionCatalog::get().lookupCollectionByNamespace()
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);
}