diff options
author | Faustoleyva54 <fausto.leyva@mongodb.com> | 2021-12-01 22:28:09 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-01 22:58:45 +0000 |
commit | 5574e83d9e5df11dd3ca9cf0151ada223edd3ec2 (patch) | |
tree | ead2f8d6e64b133ee83aa8eb97b7c0615073e69b /src/mongo/db/update | |
parent | f01e9aaa0d99f47bc6d96839e4ea3cc1108e715c (diff) | |
download | mongo-5574e83d9e5df11dd3ca9cf0151ada223edd3ec2.tar.gz |
SERVER-29262 Retire usage of `OwnedPointerVector` in `write_ops`.
Diffstat (limited to 'src/mongo/db/update')
-rw-r--r-- | src/mongo/db/update/path_support_test.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/update/update_driver.h | 1 | ||||
-rw-r--r-- | src/mongo/db/update/update_driver_test.cpp | 39 |
3 files changed, 19 insertions, 22 deletions
diff --git a/src/mongo/db/update/path_support_test.cpp b/src/mongo/db/update/path_support_test.cpp index c8dcb73a8ab..26137bfcef0 100644 --- a/src/mongo/db/update/path_support_test.cpp +++ b/src/mongo/db/update/path_support_test.cpp @@ -35,7 +35,6 @@ #include <vector> #include "mongo/base/error_codes.h" -#include "mongo/base/owned_pointer_vector.h" #include "mongo/base/simple_string_data_comparator.h" #include "mongo/base/status.h" #include "mongo/base/string_data.h" diff --git a/src/mongo/db/update/update_driver.h b/src/mongo/db/update/update_driver.h index 0f3fb02f455..d512d89b1cf 100644 --- a/src/mongo/db/update/update_driver.h +++ b/src/mongo/db/update/update_driver.h @@ -32,7 +32,6 @@ #include <string> #include <vector> -#include "mongo/base/owned_pointer_vector.h" #include "mongo/base/status.h" #include "mongo/bson/mutable/document.h" #include "mongo/db/exec/document_value/value.h" diff --git a/src/mongo/db/update/update_driver_test.cpp b/src/mongo/db/update/update_driver_test.cpp index f133caf0d56..2d03e4b7886 100644 --- a/src/mongo/db/update/update_driver_test.cpp +++ b/src/mongo/db/update/update_driver_test.cpp @@ -32,7 +32,6 @@ #include <map> -#include "mongo/base/owned_pointer_vector.h" #include "mongo/base/simple_string_data_comparator.h" #include "mongo/base/string_data.h" #include "mongo/bson/bsonelement_comparator.h" @@ -524,47 +523,47 @@ TEST_F(CreateFromQuery, ImmutableFieldsOp) { TEST_F(CreateFromQuery, ShardKeyRepl) { BSONObj query = fromjson("{a:{$eq:1}}, b:2}"); - OwnedPointerVector<FieldRef> immutablePathsVector; - immutablePathsVector.push_back(new FieldRef("a")); - immutablePathsVector.push_back(new FieldRef("_id")); + std::vector<std::unique_ptr<FieldRef>> immutablePathsVector; + immutablePathsVector.push_back(std::make_unique<FieldRef>("a")); + immutablePathsVector.push_back(std::make_unique<FieldRef>("_id")); FieldRefSet immutablePaths; - immutablePaths.fillFrom(immutablePathsVector.vector()); + immutablePaths.fillFrom(immutablePathsVector); ASSERT_OK(driverRepl().populateDocumentWithQueryFields(opCtx(), query, immutablePaths, doc())); assertSameFields(fromjson("{a:1}"), doc().getObject()); } TEST_F(CreateFromQuery, NestedShardKeyRepl) { BSONObj query = fromjson("{a:{$eq:1},'b.c':2},d:2}"); - OwnedPointerVector<FieldRef> immutablePathsVector; - immutablePathsVector.push_back(new FieldRef("a")); - immutablePathsVector.push_back(new FieldRef("b.c")); - immutablePathsVector.push_back(new FieldRef("_id")); + std::vector<std::unique_ptr<FieldRef>> immutablePathsVector; + immutablePathsVector.push_back(std::make_unique<FieldRef>("a")); + immutablePathsVector.push_back(std::make_unique<FieldRef>("b.c")); + immutablePathsVector.push_back(std::make_unique<FieldRef>("_id")); FieldRefSet immutablePaths; - immutablePaths.fillFrom(immutablePathsVector.vector()); + immutablePaths.fillFrom(immutablePathsVector); ASSERT_OK(driverRepl().populateDocumentWithQueryFields(opCtx(), query, immutablePaths, doc())); assertSameFields(fromjson("{a:1,b:{c:2}}"), doc().getObject()); } TEST_F(CreateFromQuery, NestedShardKeyOp) { BSONObj query = fromjson("{a:{$eq:1},'b.c':2,d:{$all:[3]}},e:2}"); - OwnedPointerVector<FieldRef> immutablePathsVector; - immutablePathsVector.push_back(new FieldRef("a")); - immutablePathsVector.push_back(new FieldRef("b.c")); - immutablePathsVector.push_back(new FieldRef("_id")); + std::vector<std::unique_ptr<FieldRef>> immutablePathsVector; + immutablePathsVector.push_back(std::make_unique<FieldRef>("a")); + immutablePathsVector.push_back(std::make_unique<FieldRef>("b.c")); + immutablePathsVector.push_back(std::make_unique<FieldRef>("_id")); FieldRefSet immutablePaths; - immutablePaths.fillFrom(immutablePathsVector.vector()); + immutablePaths.fillFrom(immutablePathsVector); ASSERT_OK(driverOps().populateDocumentWithQueryFields(opCtx(), query, immutablePaths, doc())); assertSameFields(fromjson("{a:1,b:{c:2},d:3}"), doc().getObject()); } TEST_F(CreateFromQuery, NotFullShardKeyRepl) { BSONObj query = fromjson("{a:{$eq:1}, 'b.c':2}, d:2}"); - OwnedPointerVector<FieldRef> immutablePathsVector; - immutablePathsVector.push_back(new FieldRef("a")); - immutablePathsVector.push_back(new FieldRef("b")); - immutablePathsVector.push_back(new FieldRef("_id")); + std::vector<std::unique_ptr<FieldRef>> immutablePathsVector; + immutablePathsVector.push_back(std::make_unique<FieldRef>("a")); + immutablePathsVector.push_back(std::make_unique<FieldRef>("b")); + immutablePathsVector.push_back(std::make_unique<FieldRef>("_id")); FieldRefSet immutablePaths; - immutablePaths.fillFrom(immutablePathsVector.vector()); + immutablePaths.fillFrom(immutablePathsVector); ASSERT_NOT_OK( driverRepl().populateDocumentWithQueryFields(opCtx(), query, immutablePaths, doc())); } |