Converting BinData of type ByteArrayDeprecated from KeyString -> BSON -> KeyString returns a different KeyString

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Fully Compatible
    • ALL
    • Hide
      diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp
      index 23285183ec..fee6b276b4 100644
      --- a/src/mongo/db/storage/key_string_test.cpp
      +++ b/src/mongo/db/storage/key_string_test.cpp
      @@ -306,6 +306,10 @@ TEST_F(KeyStringBuilderTest, Simple1) {
               }                                                                  \
           } while (0)
      
      +TEST_F(KeyStringBuilderTest, DeprecatedBinData) {
      +    ROUNDTRIP(version, BSON("" << BSONBinData(nullptr, 0, ByteArrayDeprecated)));
      +}
      +
       TEST_F(KeyStringBuilderTest, ActualBytesDouble) {
           // just one test like this for utter sanity
      
      
      Show
      diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp index 23285183ec..fee6b276b4 100644 --- a/src/mongo/db/storage/key_string_test.cpp +++ b/src/mongo/db/storage/key_string_test.cpp @@ -306,6 +306,10 @@ TEST_F(KeyStringBuilderTest, Simple1) { } \ } while (0) +TEST_F(KeyStringBuilderTest, DeprecatedBinData) { + ROUNDTRIP(version, BSON("" << BSONBinData(nullptr, 0, ByteArrayDeprecated))); +} + TEST_F(KeyStringBuilderTest, ActualBytesDouble) { // just one test like this for utter sanity
    • Execution Team 2019-10-21
    • 50
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-41994 changed the way we convert KeyString to BSON objects for BinData of type ByteArrayDeprecated. Creating the BSONElement for this type will now try to fix previously improperly made ByteArrayDeprecated elements by the shell. However, this causes a different KeyString to be created when converting from KeyString -> BSON -> KeyString for this type.

       

       

       

            Assignee:
            Gregory Wlodarek
            Reporter:
            Gregory Wlodarek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: