Repository navigation
Collection2 5.0.0
Collection2 5 modernizes the supported validation stack and adds async validation and Zod autoValues.
What's new
- Await SimpleSchema 3 cleaning, autoValues, field validators, and whole-document validators before database writes.
- Apply Zod defaults through nested objects and arrays without persisting transforms, coercions, catches, or unknown-key stripping.
- Add experimental Zod
autoValue(schema, fn)support with sync or async operation context, modifier return values, andunset(). - Support Zod autoValues in inserts, concrete
$setand$setOnInsertvalues, direct and$each$pushand$addToSetpayloads, and positional array updates. - Preserve untouched element fields during dotted positional updates and harden modifier traversal against inherited properties, accessors, and shared-prototype writes.
Breaking changes
- Meteor 3.1.2 or newer is required.
- SimpleSchema 3 is required; applications using it must call
insertAsync,updateAsync, orupsertAsyncfor mutations. - Zod 4 is required; Zod 3 schemas now fail with an explicit upgrade error.
SimpleSchema 3 async support was originally contributed by Matthew Turner (@thumptech) in #480.
See PR #504 for implementation and verification details.