summaryrefslogtreecommitdiff
path: root/src/mongo/db/fle_crud.cpp
diff options
context:
space:
mode:
authorShreyas Kalyan <shreyas.kalyan@mongodb.com>2022-08-19 18:01:45 +0200
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-19 17:33:29 +0000
commit3638a0179809ab80edb7aaaaf189a17ffb8bd611 (patch)
tree5cc5fe7892145e32980e9c9edf5ac7130bca2171 /src/mongo/db/fle_crud.cpp
parent7418e94a7dfadebf973315d5abfdf046c3679e02 (diff)
downloadmongo-3638a0179809ab80edb7aaaaf189a17ffb8bd611.tar.gz
Revert "SERVER-68065 Cannot update unindexed field in QE"
This reverts commit 9dfda2a2223724e5079da2df97775ce446481a0b.
Diffstat (limited to 'src/mongo/db/fle_crud.cpp')
-rw-r--r--src/mongo/db/fle_crud.cpp31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/mongo/db/fle_crud.cpp b/src/mongo/db/fle_crud.cpp
index 7a6ed7eb09f..783ba424cdf 100644
--- a/src/mongo/db/fle_crud.cpp
+++ b/src/mongo/db/fle_crud.cpp
@@ -841,23 +841,6 @@ write_ops::DeleteCommandReply processDelete(FLEQueryInterface* queryImpl,
return deleteReply;
}
-bool hasIndexedFieldsInSchema(const std::vector<EncryptedField>& fields) {
- for (const auto& field : fields) {
- if (field.getQueries().has_value()) {
- const auto& queries = field.getQueries().get();
- if (stdx::holds_alternative<std::vector<mongo::QueryTypeConfig>>(queries)) {
- const auto& vec = stdx::get<0>(queries);
- if (!vec.empty()) {
- return true;
- }
- } else {
- return true;
- }
- }
- }
- return false;
-}
-
/**
* Update is the most complicated FLE operation.
* It is basically an insert followed by a delete, sort of.
@@ -967,11 +950,8 @@ write_ops::UpdateCommandReply processUpdate(FLEQueryInterface* queryImpl,
// Fail if we could not find the new document
uassert(6371505, "Could not find pre-image document by _id", !newDocument.isEmpty());
- if (hasIndexedFieldsInSchema(efc.getFields())) {
- // Check the user did not remove/destroy the __safeContent__ array. If there are no
- // indexed fields, then there will not be a safeContent array in the document.
- FLEClientCrypto::validateTagsArray(newDocument);
- }
+ // Check the user did not remove/destroy the __safeContent__ array
+ FLEClientCrypto::validateTagsArray(newDocument);
// Step 5 ----
auto originalFields = EDCServerCollection::getEncryptedIndexedFields(originalDocument);
@@ -1215,11 +1195,8 @@ write_ops::FindAndModifyCommandReply processFindAndModify(
// Fail if we could not find the new document
uassert(6371404, "Could not find pre-image document by _id", !newDocument.isEmpty());
- if (hasIndexedFieldsInSchema(efc.getFields())) {
- // Check the user did not remove/destroy the __safeContent__ array. If there are no
- // indexed fields, then there will not be a safeContent array in the document.
- FLEClientCrypto::validateTagsArray(newDocument);
- }
+ // Check the user did not remove/destroy the __safeContent__ array
+ FLEClientCrypto::validateTagsArray(newDocument);
newFields = EDCServerCollection::getEncryptedIndexedFields(newDocument);
}