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

collMod with validator omits default validationAction and validationLevel

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.9.0
    • Component/s: Catalog, Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Linked BF Score:
      99

      Description

      Before SERVER-52538, when you add a document validator to a collection with the "collMod" command, the default validationAction/Level are explicitly included in the collection's catalog entry. They appear in listCollections:

      > db.runCommand({collMod: "collection", validator: ...})
      {ok: 1}
      > db.getCollectionInfos()
      [
        {
          "name" : "foo",
          "type" : "collection",
          "options" : {
            "validator" : ...,
            "validationLevel" : "strict",
            "validationAction" : "error"
          }
      ]
      

      Oddly, if you create a collection with a validator using the "create" command, the default validation action/level are OMITTED from the catalog entry. This difference is probably unintentional but we should preserve it.

      After SERVER-52538's second commit, I accidentally changed this behavior, and collMod would OMIT validation action/level from the catalog entry if the user didn't pass values for them. concurrency_replication_multiversion and other suites started failing due to the inconsistency between old and new mongods' behavior.

      It's possible I introduced an inconsistency between collMod's behavior on primaries and secondaries, but I didn't investigate. Probably not, since we only saw failures in the multiversion suites.

      To fix this, I'll restore collMod's quirk: the default validation action/level are explicitly added to the catalog entry even when the user doesn't pass them.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jesse A. Jesse Jiryu Davis
              Reporter:
              jesse A. Jesse Jiryu Davis
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: