Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-9208

Document requirement that regular expression options must be stored in alphabetical order

    • 0.5

      It was recently pointed out to me that the BSON spec requires that regular expression options be stored in alphabetical order. From bsonspec.org:

      Regular expression - The first cstring is the regex pattern, the second is the regex options string. Options are identified by characters, which must be stored in alphabetical order...

      Apparently the server takes the order of the options into account when sorting stored regular expressions (don't ask me why you would store regular expressions or need to sort them).

      Document this in the bson section of the manual:

      https://docs.mongodb.com/v3.2/reference/bson-types/

      Options order doesn't appear to matter when using a regex in query criteria, so the $regex docs probably don't need any changes.

            Assignee:
            andrew.aldridge@mongodb.com Andrew Aldridge
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              1 year, 7 weeks ago