validationLevel and validationAction
noun
say it: “val-ih-DAY-shun LEV-ul and val-ih-DAY-shun AK-shun” /ˌvælɪˈdeɪʃən ˈlɛvəl ənd ˌvælɪˈdeɪʃən ˈækʃən/
Two MongoDB collection settings for validation: which writes are checked, and whether a write that breaks the rules is refused or only logged.
What do validationLevel and validationAction decide?
validationLevel decides which writes a validator checks: "strict" (the default) checks every insert and update, and "moderate" skips updates to documents that already broke the rules. validationAction decides what happens to a bad write: "error" refuses it, and "warn" lets it in and logs a warning.
db.runCommand({
collMod: "products",
validationLevel: "moderate",
validationAction: "warn"
});
In a sentence
- “Setting validationLevel and validationAction to moderate and warn let the old products stay while new ones were checked.”
- “With validationLevel and validationAction at their defaults, strict and error, every bad write is refused.”
Level: Freelancer · More MongoDB terms at this level
Updated