Where MongoDB Schema Validation Actually Lives
MongoDB can enforce a schema, but only if you ask. I tested its validation options on 8.0 and 9.0 and compared them with SQL Server constraints.
The CHECK Constraint That Lets NULL Through
A CHECK constraint accepts a row when its predicate is UNKNOWN, so CHECK (quantity >= 0) still allows NULL. How to close the gap.