Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP2stack specificStack: node
ormsequelizemongoosedry
Use the ORM's built-in create/update methods instead of hand-rolling
Reach for Model.create / Model.update / findOneAndUpdate rather than manually composing the steps they already encapsulate — it's less code and fewer bugs.
PR: profico-mining-2026-06Created: Jul 26, 2026
Bad example
Old codejavascript
| 1 | const doc = new Model(data); await doc.validate(); await doc.save(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | const doc = await Model.create(data); |
Explanation (EN)
Objašnjenje (HR)