Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4737

Editing view causes $regexFind to be re-written

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

      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 Unassigned
            Reporter:
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: