diff options
author | Martin Neupauer <martin.neupauer@mongodb.com> | 2019-07-23 11:44:57 -0400 |
---|---|---|
committer | Martin Neupauer <martin.neupauer@mongodb.com> | 2019-07-31 15:17:22 -0400 |
commit | 3e2d338ebfbb17f26a1ab7dcbb447fbac29e549b (patch) | |
tree | d5258cb156839148b726a8ab0c0f8222cff96acf /src/mongo/db/pipeline/document_value_test.cpp | |
parent | aa249b73474ba2ca82dc251ff23d8dd318090915 (diff) | |
download | mongo-3e2d338ebfbb17f26a1ab7dcbb447fbac29e549b.tar.gz |
SERVER-42158 Efficient reset of Document to new BSONObj
Diffstat (limited to 'src/mongo/db/pipeline/document_value_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_value_test.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_value_test.cpp b/src/mongo/db/pipeline/document_value_test.cpp index f3b9e12c8de..e2910347e8f 100644 --- a/src/mongo/db/pipeline/document_value_test.cpp +++ b/src/mongo/db/pipeline/document_value_test.cpp @@ -122,6 +122,17 @@ TEST(DocumentConstruction, FromEmptyDocumentClone) { ASSERT_DOCUMENT_EQ(document, documentClone3); } +TEST(DocumentConstruction, FromBsonReset) { + auto document = Document{{"a", 1}, {"b", "q"_sd}}; + auto bson = toBson(document); + + MutableDocument md; + md.reset(bson, false); + auto newDocument = md.freeze(); + + ASSERT_BSONOBJ_EQ(bson, toBson(newDocument)); +} + /** * Appends to 'builder' an object nested 'depth' levels deep. */ |