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

Use of invalid regex in schema validator can prevent upgrade

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.2.2
    • Component/s: Querying
    • None
    • ALL
    • Query 2020-01-27, Query 2020-02-10, Query 2020-02-24, Query 2020-03-09

      Repro:

      // on 4.0 create a validator with an invalid regex.
      db.createCollection("c", {
          validator:
              {email: {$regex: "^*"}}
      })
      // Now start a 4.2 binary using same data files.
      

      The 4.2 binary will fail at startup with something like:

      [initandlisten] exception in
          initAndListen: Location51091: Regular expression is invalid: nothing to repeat,
          terminating
      

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: