From 1b51a502f9201aacf760ba37b02888bbbff831da Mon Sep 17 00:00:00 2001 From: David Storch Date: Thu, 21 Oct 2021 16:29:10 -0400 Subject: SERVER-59512 add new, cleaner query interface to DBClientBase The new interface uses FindCommandRequest, and avoids any characteristics that relate specifically to the no-longer-supported OP_QUERY wire protocol message. This patch moves all callers of 'findOne()' onto the new API, but more work is required to fully eliminate the old 'query()' API from DBClientBase. --- src/mongo/db/s/session_catalog_migration_source.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/mongo/db/s/session_catalog_migration_source.cpp') diff --git a/src/mongo/db/s/session_catalog_migration_source.cpp b/src/mongo/db/s/session_catalog_migration_source.cpp index 2981f132087..31f006da764 100644 --- a/src/mongo/db/s/session_catalog_migration_source.cpp +++ b/src/mongo/db/s/session_catalog_migration_source.cpp @@ -61,10 +61,8 @@ boost::optional forgeNoopEntryFromImageCollection( DBDirectClient client(opCtx); BSONObj imageObj = - client.findOne(NamespaceString::kConfigImagesNamespace.ns(), - BSON("_id" << retryableFindAndModifyOplogEntry.getSessionId()->toBSON()), - Query(), - nullptr); + client.findOne(NamespaceString::kConfigImagesNamespace, + BSON("_id" << retryableFindAndModifyOplogEntry.getSessionId()->toBSON())); if (imageObj.isEmpty()) { return boost::none; } @@ -124,8 +122,7 @@ boost::optional fetchPrePostImageOplog(OperationContext* opCtx auto opTime = opTimeToFetch.value(); DBDirectClient client(opCtx); - auto oplogBSON = - client.findOne(NamespaceString::kRsOplogNamespace.ns(), opTime.asQuery(), Query(), nullptr); + auto oplogBSON = client.findOne(NamespaceString::kRsOplogNamespace, opTime.asQuery()); return uassertStatusOK(repl::OplogEntry::parse(oplogBSON)); } @@ -437,8 +434,8 @@ bool SessionCatalogMigrationSource::_fetchNextNewWriteOplog(OperationContext* op } DBDirectClient client(opCtx); - const auto& newWriteOplogDoc = client.findOne( - NamespaceString::kRsOplogNamespace.ns(), nextOpTimeToFetch.asQuery(), Query(), nullptr); + const auto& newWriteOplogDoc = + client.findOne(NamespaceString::kRsOplogNamespace, nextOpTimeToFetch.asQuery()); uassert(40620, str::stream() << "Unable to fetch oplog entry with opTime: " -- cgit v1.2.1