ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • ALL
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Some of LogCaptureGuard's BSON subset matching functions ignore any elements following a nested object field if the object matches. For example, when checking the following (in a code block for jira formatting reasons):

       {a: {b: 1}, thiswillbeignored: 2} is a subset of {a: {b: 1}, thiswillalsobeignored: 3}
      

      It will erroneously return true because b: 1 matched the key a in both sides.

      The following test added in log_capture_test.cpp would illustrate the issue:

      TEST(LogCaptureTest, isSubsetBug) {
          static constexpr int logId = 10903008;
          LogCaptureGuard logs;
          LOGV2(logId, "Test", "a"_attr = 1);
          logs.stop();
          // Note: logId + 1: this should not match but it does.
          ASSERT_EQ(logs.countBSONContainingSubset(BSON("attr" << BSON("a" << 1) << "id" << logId + 1)), 0);
      }
      

            Assignee:
            Unassigned
            Reporter:
            Ryan Berryhill
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: