Editing view causes $regexFind to be re-written

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • 5
    • None
    • None

      Problem Description

      While editing a view, I noticed that my query results change. I defined my view as :

      {$addFields: {
        returnObject: {
          $regexFind: {
            input: "$Job", regex: /\[(.*)\]/    }
        }
      }

      But when I click "modify source" the view is now defined as:

      [{$addFields: {
        returnObject: {
          $regexFind: {
            input: '$Job',
            regex: RegExp('\[(.*)\]')
          }
        }
      }
      

      This is creating a different capture in the $regexFind. This may be a server bug, but the re-writing of the query exposed this. Saving the query as a view does not cause the view definition to be re-written – it's only on modifying it. I raised SERVER-55583 to check on the syntax difference. You can see that report for raw repro.

       

      Steps to Reproduce

      Expected Results

      Actual Results

      Additional Notes

              Assignee:
              Unassigned
              Reporter:
              Daniel Pasette (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: