diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-07-31 17:56:57 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-08-01 15:39:23 -0400 |
commit | e30faa0f9bf498680b981bbbd36c6307134bf49e (patch) | |
tree | 60dc58d6c89a0fea34ac7aab706143284a419d11 /src/mongo/idl/idl_test.cpp | |
parent | 04a20a7f4d95c7ab03937931d918708e2ff5b250 (diff) | |
download | mongo-e30faa0f9bf498680b981bbbd36c6307134bf49e.tar.gz |
SERVER-30441 Correctly set the _hasField value when deserializing from OpMsgRequest
Diffstat (limited to 'src/mongo/idl/idl_test.cpp')
-rw-r--r-- | src/mongo/idl/idl_test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/idl/idl_test.cpp b/src/mongo/idl/idl_test.cpp index da220fdad21..a67de83a429 100644 --- a/src/mongo/idl/idl_test.cpp +++ b/src/mongo/idl/idl_test.cpp @@ -1737,6 +1737,20 @@ void TestDocSequence(StringData name) { ASSERT_EQUALS(2UL, testStruct.getStructs().size()); ASSERT_EQUALS("hello", testStruct.getStructs()[0].getValue()); ASSERT_EQUALS("world", testStruct.getStructs()[1].getValue()); + + auto opmsg = testStruct.serialize(BSONObj()); + + BSONObjBuilder builder; + builder.appendElements(testTempDoc); + builder.append("structs", + BSON_ARRAY(BSON("value" + << "hello") + << BSON("value" + << "world"))); + builder.append("objects", BSON_ARRAY(BSON("foo" << 1))); + auto testCompleteMsg = OpMsgRequest::fromDBAndBody("db", builder.obj()); + + ASSERT_BSONOBJ_EQ(opmsg.body, testCompleteMsg.body); } // Positive: Test a command read and written to OpMsgRequest with content in DocumentSequence works |