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

Regex pattern in validation $jsonSchema is not validated whatsoever

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.6
    • Component/s: Querying
    • Labels:
      None
    • ALL
    • Hide

      Run this code changing process.env.URL_SERVER_MONGODB for your own test server:

      Code to reproduce the issue

      Show
      Run this code changing process.env.URL_SERVER_MONGODB for your own test server: Code to reproduce the issue

      I have defined this schema for a new collection and it executes correctly but it accepts any string for friend_code and does not trigger the pattern validation when I insert new rows with non-matching strings in that property.

      As you can see in the provided code (in steps to reproduce), a row with a clearly unmatching string for the provided pattern is inserted after creating the collection instead of reporting an error.

      Things I've tried:

      • Changing the value of pattern to javascript regex with slashes instead of a string, does not work
      • Changing the validation to a simple one, still allows all the values

      Every time I test those things I delete the collection, so it stays up to date with the code.

       

            Assignee:
            nick.brewer Nick Brewer
            Reporter:
            Welcius Welcius Oshino [X]
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: