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 }