Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-93442

Refactor findMatchingLogLines to prevent misuse and improve clarity

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Security
    • Fully Compatible
    • Security 2024-08-19

      The findMatchingLogLines function is returning an iterator that yields each matched log line in the array one by one (code). This allows us to process each matched log line as it is ready, rather than return entire matched logs. But, some jstest codes (here) use its return as an array.  It's not correct.

      The correct usage is that using for-of loop to iterate the matched log lines one by one or using `[...findMatchingLogLines(logs, fields)]` to return all matched log lines. 

      In this ticket, we will fix the call site codes which do not use this function correctly. Also, we will refactor this function by adding code comment and renaming it to prevent misuse and improve clarity.

            Assignee:
            sophia.tan@mongodb.com Sophia Tan
            Reporter:
            sophia.tan@mongodb.com Sophia Tan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: