Skip to content

valuesEqual

valuesEqual(a, b): boolean

Defined in: packages/core/src/utils/valuesEqual.ts:27

Structural equality over Convex values.

Convex compares values by CONTENT, both in an index range and in a .filter() expression. JS === compares arrays and objects by REFERENCE, so using it for the predicate made the two compile targets disagree for every array-valued field — which is every relationship and select field, since both store v.array(...).

The divergence was not symmetric, and one direction was unsafe: eq produced a false NEGATIVE (the query returned a row the predicate then rejected, so a client denied access the server had granted), while neq produced a false POSITIVE (the predicate admitted a row the query had excluded). The second is the dangerous one, and it is why this is content equality rather than a special case for eq.

undefined equals undefined, which keeps “field missing” and “field explicitly undefined” indistinguishable — matching how a document read through bracket access behaves, and matching Convex, which stores neither.

Also the general-purpose deep-equality helper for plain JSON-shaped values (Convex documents contain only these), used anywhere two values need to be compared by content rather than by reference.

unknown

Left value.

unknown

Right value.

boolean

true when the two values are structurally equal.