ExportXMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.1.0-rc0, 9.1.0-rc1024
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • Fully Compatible
    • Storage Execution 2026-10-12, Storage Execution 2026-10-26
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      auto ValidateAdaptor::validateRecord(...) const {
          const Status bsonValidationStatus = validateBSON(...);
      
          if (!bsonValidationStatus.isOK()) {
              ...
              switch (bsonValidationStatus.code()) {
                  case ErrorCodes::NonConformantBSON:
                      LOGV2_WARNING_OPTIONS(..., "Document is not conformant to BSON specifications", ...);
                      ...
                      break;
                  default:
                      LOGV2_ERROR_OPTIONS("Error occurred during BSON validation", ...);
                      return {.status = bsonValidationStatus, ...};
              }
          ...
          }
          const BSONObj recordBson = record.data.toBson();
      
          // Other work on recordBson
      }

      ValidateAdaptor::validateRecord swallows NonConformantBSON errors and just logs an error. After the non conformant element, it is possible for the rest of the BSON to be invalid. Code expecting valid BSON can now operate on invalid BSON.

            Assignee:
            Benjamin Pearce
            Reporter:
            Alex Li
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: