Summary
find({ field: undefined }) uses deepEqual where undefined matches documents missing the field — inverted vs typical JS { field: undefined } "must be undefined property" semantics.
Audit ID: Section 4 Low — Wave 3
Location: src/lens/document.ts:78-79, matches()
Fix options
- Treat explicit
undefined in predicate as "field must exist and be undefined" (impossible for JsonValue) → match nothing for that key, or throw.
- Document that
undefined means "field absent" explicitly in JSDoc.
Prefer (1) or exclude undefined keys from predicate iteration.
Acceptance criteria
Summary
find({ field: undefined })usesdeepEqualwhereundefinedmatches documents missing the field — inverted vs typical JS{ field: undefined }"must be undefined property" semantics.Audit ID: Section 4 Low — Wave 3
Location:
src/lens/document.ts:78-79,matches()Fix options
undefinedin predicate as "field must exist and be undefined" (impossible for JsonValue) → match nothing for that key, or throw.undefinedmeans "field absent" explicitly in JSDoc.Prefer (1) or exclude undefined keys from predicate iteration.
Acceptance criteria
document.test.ts.