summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2023-02-08 16:47:00 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-13 21:29:42 +0000
commitdbf910360b98dd3c61fa6b19c33945f46588eff1 (patch)
tree41c10fc39fe58cdfae0c4984b699cdd706615225
parentf76c8220112808cd58e8947b270a3e9d03a11c3b (diff)
downloadmongo-dbf910360b98dd3c61fa6b19c33945f46588eff1.tar.gz
SERVER-73643 Change query tags interface to FLEQueryInterface
-rw-r--r--src/mongo/crypto/fle_tags.cpp17
-rw-r--r--src/mongo/crypto/fle_tags.h9
-rw-r--r--src/mongo/db/fle_crud.cpp2
-rw-r--r--src/mongo/db/fle_crud.h16
-rw-r--r--src/mongo/db/fle_crud_test.cpp6
-rw-r--r--src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h19
-rw-r--r--src/mongo/db/query/fle/equality_predicate.cpp5
-rw-r--r--src/mongo/db/query/fle/query_rewriter.h45
-rw-r--r--src/mongo/db/query/fle/query_rewriter_interface.h9
-rw-r--r--src/mongo/db/query/fle/query_rewriter_test.cpp10
-rw-r--r--src/mongo/db/query/fle/range_predicate.cpp7
-rw-r--r--src/mongo/db/query/fle/server_rewrite.cpp52
-rw-r--r--src/mongo/db/query/fle/server_rewrite.h6
13 files changed, 125 insertions, 78 deletions
diff --git a/src/mongo/crypto/fle_tags.cpp b/src/mongo/crypto/fle_tags.cpp
index abad71d2b71..d24fe5488d6 100644
--- a/src/mongo/crypto/fle_tags.cpp
+++ b/src/mongo/crypto/fle_tags.cpp
@@ -31,6 +31,8 @@
#include "mongo/crypto/fle_crypto.h"
#include "mongo/crypto/fle_tags.h"
+#include "mongo/db/fle_crud.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/query/query_knobs_gen.h"
namespace mongo::fle {
@@ -199,12 +201,23 @@ std::vector<PrfBlock> readTagsWithContention(const FLEStateCollectionReader& esc
}
// A positive contention factor (cm) means we must run the above algorithm (cm) times.
-std::vector<PrfBlock> readTags(const FLEStateCollectionReader& esc,
- const FLEStateCollectionReader& ecc,
+std::vector<PrfBlock> readTags(FLETagQueryInterface* queryImpl,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc,
ESCDerivedFromDataToken s,
ECCDerivedFromDataToken c,
EDCDerivedFromDataToken d,
boost::optional<int64_t> cm) {
+
+ auto makeCollectionReader = [](FLETagQueryInterface* queryImpl, const NamespaceString& nss) {
+ auto docCount = queryImpl->countDocuments(nss);
+ return TxnCollectionReader(docCount, queryImpl, nss);
+ };
+
+ // Construct FLE rewriter from the transaction client and encryptionInformation.
+ auto esc = makeCollectionReader(queryImpl, nssEsc);
+ auto ecc = makeCollectionReader(queryImpl, nssEcc);
+
// The output of readTags will be used as the argument to a $in expression, so make sure we
// don't exceed the configured memory limit.
auto limit = static_cast<size_t>(internalQueryFLERewriteMemoryLimit.load());
diff --git a/src/mongo/crypto/fle_tags.h b/src/mongo/crypto/fle_tags.h
index b6a4fc82cd6..d88bd42dc0a 100644
--- a/src/mongo/crypto/fle_tags.h
+++ b/src/mongo/crypto/fle_tags.h
@@ -33,6 +33,10 @@
#include "mongo/crypto/fle_crypto.h"
+namespace mongo {
+class FLETagQueryInterface;
+}
+
namespace mongo::fle {
/**
@@ -52,8 +56,9 @@ std::vector<PrfBlock> readTagsWithContention(const FLEStateCollectionReader& esc
* Read a list of binary tags given ESC, ECC, and EDC derived tokens and a maximum contention
* factor.
*/
-std::vector<PrfBlock> readTags(const FLEStateCollectionReader& esc,
- const FLEStateCollectionReader& ecc,
+std::vector<PrfBlock> readTags(FLETagQueryInterface* queryImpl,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc,
ESCDerivedFromDataToken s,
ECCDerivedFromDataToken c,
EDCDerivedFromDataToken d,
diff --git a/src/mongo/db/fle_crud.cpp b/src/mongo/db/fle_crud.cpp
index df2414dbd62..3a4d0d1fb02 100644
--- a/src/mongo/db/fle_crud.cpp
+++ b/src/mongo/db/fle_crud.cpp
@@ -895,7 +895,7 @@ processFindAndModifyRequest<write_ops::FindAndModifyCommandRequest>(
GetTxnCallback getTxns,
ProcessFindAndModifyCallback<write_ops::FindAndModifyCommandRequest> processCallback);
-FLEQueryInterface::~FLEQueryInterface() {}
+FLETagQueryInterface::~FLETagQueryInterface() {}
StatusWith<write_ops::InsertCommandReply> processInsert(
FLEQueryInterface* queryImpl,
diff --git a/src/mongo/db/fle_crud.h b/src/mongo/db/fle_crud.h
index eb58ceadb7a..afd288a339d 100644
--- a/src/mongo/db/fle_crud.h
+++ b/src/mongo/db/fle_crud.h
@@ -226,11 +226,11 @@ bool shouldDoFLERewrite(const T& cmd) {
}
/**
- * Abstraction layer for FLE
+ * Basic set of functions to read/query data from state collections to perform EmuBinary.
*/
-class FLEQueryInterface {
+class FLETagQueryInterface {
public:
- virtual ~FLEQueryInterface();
+ virtual ~FLETagQueryInterface();
/**
* Retrieve a single document by _id == BSONElement from nss.
@@ -246,7 +246,13 @@ public:
* Throws if the collection is not found.
*/
virtual uint64_t countDocuments(const NamespaceString& nss) = 0;
+};
+/**
+ * Abstraction layer for FLE
+ */
+class FLEQueryInterface : public FLETagQueryInterface {
+public:
/**
* Insert a document into the given collection.
*
@@ -362,7 +368,7 @@ private:
*/
class TxnCollectionReader : public FLEStateCollectionReader {
public:
- TxnCollectionReader(uint64_t count, FLEQueryInterface* queryImpl, const NamespaceString& nss)
+ TxnCollectionReader(uint64_t count, FLETagQueryInterface* queryImpl, const NamespaceString& nss)
: _count(count), _queryImpl(queryImpl), _nss(nss) {}
uint64_t getDocumentCount() const override {
@@ -377,7 +383,7 @@ public:
private:
uint64_t _count;
- FLEQueryInterface* _queryImpl;
+ FLETagQueryInterface* _queryImpl;
NamespaceString _nss;
};
diff --git a/src/mongo/db/fle_crud_test.cpp b/src/mongo/db/fle_crud_test.cpp
index 3267433a989..0f112b4f162 100644
--- a/src/mongo/db/fle_crud_test.cpp
+++ b/src/mongo/db/fle_crud_test.cpp
@@ -758,9 +758,9 @@ protected:
auto s = getTestESCDataToken(obj);
auto c = getTestECCDataToken(obj);
auto d = getTestEDCDataToken(obj);
- auto esc = CollectionReader("test.esc", *_queryImpl);
- auto ecc = CollectionReader("test.ecc", *_queryImpl);
- return mongo::fle::readTags(esc, ecc, s, c, d, cm);
+ auto nssEsc = NamespaceString("test.esc");
+ auto nssEcc = NamespaceString("test.ecc");
+ return mongo::fle::readTags(_queryImpl.get(), nssEsc, nssEcc, s, c, d, cm);
}
};
diff --git a/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h b/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h
index 718ea6a324b..6880edb738e 100644
--- a/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h
+++ b/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h
@@ -30,6 +30,7 @@
#pragma once
#include "mongo/db/matcher/expression_array.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/pipeline/expression_context_for_test.h"
#include "mongo/db/query/fle/encrypted_predicate.h"
#include "mongo/db/query/fle/equality_predicate.h"
@@ -48,12 +49,6 @@ using TagMap = std::map<std::pair<StringData, int>, std::vector<PrfBlock>>;
class MockServerRewrite : public QueryRewriterInterface {
public:
MockServerRewrite() : _expCtx((new ExpressionContextForTest())) {}
- const FLEStateCollectionReader* getEscReader() const override {
- return nullptr;
- }
- const FLEStateCollectionReader* getEccReader() const override {
- return nullptr;
- }
EncryptedCollScanMode getEncryptedCollScanMode() const override {
return _mode;
};
@@ -65,9 +60,21 @@ public:
_mode = EncryptedCollScanMode::kForceAlways;
}
+ FLETagQueryInterface* getTagQueryInterface() const override {
+ return nullptr;
+ };
+ const NamespaceString& getESCNss() const override {
+ return _mockNss;
+ }
+ const NamespaceString& getECCNss() const override {
+ return _mockNss;
+ }
+
+
private:
boost::intrusive_ptr<ExpressionContextForTest> _expCtx;
EncryptedCollScanMode _mode{EncryptedCollScanMode::kUseIfNeeded};
+ NamespaceString _mockNss{"mock"_sd};
};
class EncryptedPredicateRewriteTest : public unittest::Test {
diff --git a/src/mongo/db/query/fle/equality_predicate.cpp b/src/mongo/db/query/fle/equality_predicate.cpp
index b8fef3178f5..3a068789490 100644
--- a/src/mongo/db/query/fle/equality_predicate.cpp
+++ b/src/mongo/db/query/fle/equality_predicate.cpp
@@ -47,8 +47,9 @@ REGISTER_ENCRYPTED_AGG_PREDICATE_REWRITE(ExpressionIn, EqualityPredicate);
std::vector<PrfBlock> EqualityPredicate::generateTags(BSONValue payload) const {
ParsedFindEqualityPayload tokens = parseFindPayload<ParsedFindEqualityPayload>(payload);
- return readTags(*_rewriter->getEscReader(),
- *_rewriter->getEccReader(),
+ return readTags(_rewriter->getTagQueryInterface(),
+ _rewriter->getESCNss(),
+ _rewriter->getECCNss(),
tokens.escToken,
tokens.eccToken,
tokens.edcToken,
diff --git a/src/mongo/db/query/fle/query_rewriter.h b/src/mongo/db/query/fle/query_rewriter.h
index cf8470a84ac..7552a75d486 100644
--- a/src/mongo/db/query/fle/query_rewriter.h
+++ b/src/mongo/db/query/fle/query_rewriter.h
@@ -31,6 +31,7 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/crypto/fle_crypto.h"
+#include "mongo/db/fle_crud.h"
#include "mongo/db/pipeline/expression_context.h"
#include "mongo/db/query/fle/encrypted_predicate.h"
#include "mongo/db/query/fle/query_rewriter_interface.h"
@@ -54,14 +55,16 @@ public:
* computation.
*/
QueryRewriter(boost::intrusive_ptr<ExpressionContext> expCtx,
- const FLEStateCollectionReader& escReader,
- const FLEStateCollectionReader& eccReader,
+ FLETagQueryInterface* tagQueryInterface,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc,
EncryptedCollScanModeAllowed mode = EncryptedCollScanModeAllowed::kAllow)
: _expCtx(expCtx),
- _escReader(&escReader),
- _eccReader(&eccReader),
_exprRewrites(aggPredicateRewriteMap),
- _matchRewrites(matchPredicateRewriteMap) {
+ _matchRewrites(matchPredicateRewriteMap),
+ _nssEsc(nssEsc),
+ _nssEcc(nssEcc),
+ _tagQueryInterface(tagQueryInterface) {
if (internalQueryFLEAlwaysUseEncryptedCollScanMode.load()) {
_mode = EncryptedCollScanMode::kForceAlways;
@@ -108,28 +111,34 @@ public:
return _mode;
}
- const FLEStateCollectionReader* getEscReader() const override {
- return _escReader;
+ ExpressionContext* getExpressionContext() const override {
+ return _expCtx.get();
}
- const FLEStateCollectionReader* getEccReader() const override {
- return _eccReader;
+ FLETagQueryInterface* getTagQueryInterface() const override {
+ return _tagQueryInterface;
}
- ExpressionContext* getExpressionContext() const override {
- return _expCtx.get();
+ const NamespaceString& getESCNss() const override {
+ return _nssEsc;
+ }
+ const NamespaceString& getECCNss() const override {
+ return _nssEcc;
}
protected:
// This constructor should only be used for mocks in testing.
QueryRewriter(boost::intrusive_ptr<ExpressionContext> expCtx,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc,
const ExpressionToRewriteMap& exprRewrites,
const MatchTypeToRewriteMap& matchRewrites)
: _expCtx(expCtx),
- _escReader(nullptr),
- _eccReader(nullptr),
_exprRewrites(exprRewrites),
- _matchRewrites(matchRewrites) {}
+ _matchRewrites(matchRewrites),
+ _nssEsc(nssEsc),
+ _nssEcc(nssEcc),
+ _tagQueryInterface(nullptr) {}
private:
/**
@@ -139,11 +148,6 @@ private:
boost::intrusive_ptr<ExpressionContext> _expCtx;
- // Holds a pointer so that these can be null for tests, even though the public constructor
- // takes a const reference.
- const FLEStateCollectionReader* _escReader;
- const FLEStateCollectionReader* _eccReader;
-
// True if the last Expression or MatchExpression processed by this rewriter was rewritten.
bool _rewroteLastExpression = false;
@@ -152,5 +156,8 @@ private:
const ExpressionToRewriteMap& _exprRewrites;
const MatchTypeToRewriteMap& _matchRewrites;
+ const NamespaceString& _nssEsc;
+ const NamespaceString& _nssEcc;
+ FLETagQueryInterface* _tagQueryInterface;
};
} // namespace mongo::fle
diff --git a/src/mongo/db/query/fle/query_rewriter_interface.h b/src/mongo/db/query/fle/query_rewriter_interface.h
index 60f54defeac..8d7ddde7a4a 100644
--- a/src/mongo/db/query/fle/query_rewriter_interface.h
+++ b/src/mongo/db/query/fle/query_rewriter_interface.h
@@ -33,6 +33,9 @@
#include "mongo/db/pipeline/expression_context.h"
namespace mongo {
+
+class FLETagQueryInterface;
+
namespace fle {
enum class EncryptedCollScanMode {
// Always use high cardinality filters, used by tests
@@ -62,8 +65,10 @@ enum class EncryptedCollScanModeAllowed {
class QueryRewriterInterface {
public:
virtual ~QueryRewriterInterface() {}
- virtual const FLEStateCollectionReader* getEscReader() const = 0;
- virtual const FLEStateCollectionReader* getEccReader() const = 0;
+ virtual FLETagQueryInterface* getTagQueryInterface() const = 0;
+ virtual const NamespaceString& getESCNss() const = 0;
+ virtual const NamespaceString& getECCNss() const = 0;
+
virtual EncryptedCollScanMode getEncryptedCollScanMode() const = 0;
virtual ExpressionContext* getExpressionContext() const = 0;
};
diff --git a/src/mongo/db/query/fle/query_rewriter_test.cpp b/src/mongo/db/query/fle/query_rewriter_test.cpp
index 057bae0dd2b..9c2bc41a28c 100644
--- a/src/mongo/db/query/fle/query_rewriter_test.cpp
+++ b/src/mongo/db/query/fle/query_rewriter_test.cpp
@@ -37,6 +37,7 @@
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/bson/bsontypes.h"
#include "mongo/db/matcher/expression_leaf.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/pipeline/expression.h"
#include "mongo/db/pipeline/expression_context_for_test.h"
#include "mongo/db/query/fle/encrypted_predicate.h"
@@ -237,8 +238,10 @@ void setMockRewriteMaps(fle::MatchTypeToRewriteMap& match,
class MockQueryRewriter : public fle::QueryRewriter {
public:
MockQueryRewriter(fle::ExpressionToRewriteMap* exprRewrites,
- fle::MatchTypeToRewriteMap* matchRewrites)
- : fle::QueryRewriter(new ExpressionContextForTest(), *exprRewrites, *matchRewrites) {
+ fle::MatchTypeToRewriteMap* matchRewrites,
+ const NamespaceString& mockNss)
+ : fle::QueryRewriter(
+ new ExpressionContextForTest(), mockNss, mockNss, *exprRewrites, *matchRewrites) {
setMockRewriteMaps(*matchRewrites, *exprRewrites, _tags, _encryptedFields);
}
@@ -265,7 +268,7 @@ public:
FLEServerRewriteTest() : _mock(nullptr) {}
void setUp() override {
- _mock = std::make_unique<MockQueryRewriter>(&_agg, &_match);
+ _mock = std::make_unique<MockQueryRewriter>(&_agg, &_match, _mockNss);
}
void tearDown() override {}
@@ -274,6 +277,7 @@ protected:
std::unique_ptr<MockQueryRewriter> _mock;
fle::ExpressionToRewriteMap _agg;
fle::MatchTypeToRewriteMap _match;
+ NamespaceString _mockNss{"mock"_sd};
};
#define ASSERT_MATCH_EXPRESSION_REWRITE(input, expected) \
diff --git a/src/mongo/db/query/fle/range_predicate.cpp b/src/mongo/db/query/fle/range_predicate.cpp
index 852d03095de..8dbfb596318 100644
--- a/src/mongo/db/query/fle/range_predicate.cpp
+++ b/src/mongo/db/query/fle/range_predicate.cpp
@@ -117,9 +117,12 @@ std::vector<PrfBlock> RangePredicate::generateTags(BSONValue payload) const {
auto parsedPayload = parseFindPayload<ParsedFindRangePayload>(payload);
std::vector<PrfBlock> tags;
tassert(7030500, "Must generate tags from a non-stub payload.", !parsedPayload.isStub());
+
+ // TODO - do batch generation of tags here
for (auto& edge : parsedPayload.edges.value()) {
- auto tagsForEdge = readTags(*_rewriter->getEscReader(),
- *_rewriter->getEccReader(),
+ auto tagsForEdge = readTags(_rewriter->getTagQueryInterface(),
+ _rewriter->getESCNss(),
+ _rewriter->getECCNss(),
edge.esc,
edge.ecc,
edge.edc,
diff --git a/src/mongo/db/query/fle/server_rewrite.cpp b/src/mongo/db/query/fle/server_rewrite.cpp
index 6575a2483d2..2896bb87a85 100644
--- a/src/mongo/db/query/fle/server_rewrite.cpp
+++ b/src/mongo/db/query/fle/server_rewrite.cpp
@@ -121,14 +121,15 @@ REGISTER_DOCUMENT_SOURCE_FLE_REWRITER(DocumentSourceMatch, rewriteMatch);
REGISTER_DOCUMENT_SOURCE_FLE_REWRITER(DocumentSourceGeoNear, rewriteGeoNear);
REGISTER_DOCUMENT_SOURCE_FLE_REWRITER(DocumentSourceGraphLookUp, rewriteGraphLookUp);
-BSONObj rewriteEncryptedFilter(const FLEStateCollectionReader& escReader,
- const FLEStateCollectionReader& eccReader,
+BSONObj rewriteEncryptedFilter(FLETagQueryInterface* queryImpl,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc,
boost::intrusive_ptr<ExpressionContext> expCtx,
BSONObj filter,
EncryptedCollScanModeAllowed mode) {
if (auto rewritten =
- QueryRewriter(expCtx, escReader, eccReader, mode).rewriteMatchExpression(filter)) {
+ QueryRewriter(expCtx, queryImpl, nssEsc, nssEcc, mode).rewriteMatchExpression(filter)) {
return rewritten.value();
}
@@ -146,8 +147,9 @@ public:
ecc = efc.getEccCollection()->toString();
}
virtual ~RewriteBase(){};
- virtual void doRewrite(FLEStateCollectionReader& escReader,
- FLEStateCollectionReader& eccReader){};
+ virtual void doRewrite(FLEQueryInterface* queryImpl,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc){};
boost::intrusive_ptr<ExpressionContext> expCtx;
std::string esc;
@@ -164,8 +166,10 @@ public:
: RewriteBase(toRewrite->getContext(), nss, encryptInfo), pipeline(std::move(toRewrite)) {}
~PipelineRewrite(){};
- void doRewrite(FLEStateCollectionReader& escReader, FLEStateCollectionReader& eccReader) final {
- auto rewriter = QueryRewriter(expCtx, escReader, eccReader);
+ void doRewrite(FLEQueryInterface* queryImpl,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc) final {
+ auto rewriter = QueryRewriter(expCtx, queryImpl, nssEsc, nssEcc);
for (auto&& source : pipeline->getSources()) {
if (stageRewriterMap.find(typeid(*source)) != stageRewriterMap.end()) {
stageRewriterMap[typeid(*source)](&rewriter, source.get());
@@ -192,8 +196,11 @@ public:
: RewriteBase(expCtx, nss, encryptInfo), userFilter(toRewrite), _mode(mode) {}
~FilterRewrite(){};
- void doRewrite(FLEStateCollectionReader& escReader, FLEStateCollectionReader& eccReader) final {
- rewrittenFilter = rewriteEncryptedFilter(escReader, eccReader, expCtx, userFilter, _mode);
+ void doRewrite(FLEQueryInterface* queryImpl,
+ const NamespaceString& nssEsc,
+ const NamespaceString& nssEcc) final {
+ rewrittenFilter =
+ rewriteEncryptedFilter(queryImpl, nssEsc, nssEcc, expCtx, userFilter, _mode);
}
const BSONObj userFilter;
@@ -211,20 +218,14 @@ void doFLERewriteInTxn(OperationContext* opCtx,
auto txn = getTxn(opCtx);
auto swCommitResult = txn->runNoThrow(
opCtx, [sharedBlock](const txn_api::TransactionClient& txnClient, auto txnExec) {
- auto makeCollectionReader = [sharedBlock](FLEQueryInterface* queryImpl,
- const StringData& coll) {
- NamespaceString nss(sharedBlock->db, coll);
- auto docCount = queryImpl->countDocuments(nss);
- return TxnCollectionReader(docCount, queryImpl, nss);
- };
+ NamespaceString nssEsc(sharedBlock->db, sharedBlock->esc);
+ NamespaceString nssEcc(sharedBlock->db, sharedBlock->ecc);
// Construct FLE rewriter from the transaction client and encryptionInformation.
auto queryInterface = FLEQueryInterfaceImpl(txnClient, getGlobalServiceContext());
- auto escReader = makeCollectionReader(&queryInterface, sharedBlock->esc);
- auto eccReader = makeCollectionReader(&queryInterface, sharedBlock->ecc);
// Rewrite the MatchExpression.
- sharedBlock->doRewrite(escReader, eccReader);
+ sharedBlock->doRewrite(&queryInterface, nssEsc, nssEcc);
return SemiFuture<void>::makeReady();
});
@@ -235,21 +236,16 @@ void doFLERewriteInTxn(OperationContext* opCtx,
}
} // namespace
-BSONObj rewriteEncryptedFilterInsideTxn(FLEQueryInterface* queryImpl,
+BSONObj rewriteEncryptedFilterInsideTxn(FLETagQueryInterface* queryImpl,
const DatabaseName& dbName,
const EncryptedFieldConfig& efc,
boost::intrusive_ptr<ExpressionContext> expCtx,
BSONObj filter,
EncryptedCollScanModeAllowed mode) {
- auto makeCollectionReader = [&](FLEQueryInterface* queryImpl, const StringData& coll) {
- NamespaceString nss(dbName, coll);
- auto docCount = queryImpl->countDocuments(nss);
- return TxnCollectionReader(docCount, queryImpl, nss);
- };
- auto escReader = makeCollectionReader(queryImpl, efc.getEscCollection().value());
- auto eccReader = makeCollectionReader(queryImpl, efc.getEccCollection().value());
-
- return rewriteEncryptedFilter(escReader, eccReader, expCtx, filter, mode);
+ NamespaceString nssEsc(dbName, efc.getEscCollection().value());
+ NamespaceString nssEcc(dbName, efc.getEccCollection().value());
+
+ return rewriteEncryptedFilter(queryImpl, nssEsc, nssEcc, expCtx, filter, mode);
}
BSONObj rewriteQuery(OperationContext* opCtx,
diff --git a/src/mongo/db/query/fle/server_rewrite.h b/src/mongo/db/query/fle/server_rewrite.h
index c086548b23d..61db414c32f 100644
--- a/src/mongo/db/query/fle/server_rewrite.h
+++ b/src/mongo/db/query/fle/server_rewrite.h
@@ -47,7 +47,7 @@
* This file contains the interface for rewriting filters within CRUD commands for FLE2.
*/
namespace mongo {
-class FLEQueryInterface;
+class FLETagQueryInterface;
namespace fle {
@@ -103,11 +103,11 @@ std::unique_ptr<Pipeline, PipelineDeleter> processPipeline(
/**
* Rewrite a filter MatchExpression with FLE Find Payloads into a disjunction over the tag array
- * from inside an existing transaction using a FLEQueryInterface constructed from a
+ * from inside an existing transaction using a FLETagQueryInterface constructed from a
* transaction client.
*/
BSONObj rewriteEncryptedFilterInsideTxn(
- FLEQueryInterface* queryImpl,
+ FLETagQueryInterface* queryImpl,
const DatabaseName& dbName,
const EncryptedFieldConfig& efc,
boost::intrusive_ptr<ExpressionContext> expCtx,