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

collmod expireAfterSeconds should correctly handle bad keyPattern and unrecognized fields

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: Admin, TTL
    • Minor Change
    • ALL
    • Execution Team 2020-06-15

      The collmod command should handle the following errors more gracefully.
      (1) a bad keyPattern should fail with message "keyPattern not found" (it currently fails with message "no keyPattern specified")

      > db.runCommand( {collMod: "a", "index" : { "keyPattern" : "bad" , "expireAfterSeconds" : 100 } } )
      { "ok" : 0, "errmsg" : "no keyPattern specified" }
      

      (2) an unrecognized field in the index should fail with message "unrecognized index field (it currently ignores the field and carries on silently)

      > db.runCommand( {collMod: "a", "index" : { "keyPattern" : {status:1} , "expireAfterSeconds" : 100, 'foo':1 } } )
      { "ok" : 1 }
      

            Assignee:
            gregory.noma@mongodb.com Gregory Noma
            Reporter:
            gjmurakami Gary Murakami
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: