Skip to content

v5.0.1

Latest

Choose a tag to compare

@harryadel harryadel released this 01 Dec 20:50
  • Fix server upserts whose selector has an empty _id (undefined, null, or ''). Meteor replaces such a selector with a generated _id, so Collection2 no longer validates the selector's fields as part of the inserted document (#505). With a SimpleSchema schema that requires _id, an upsert with _id: '' is now rejected like any other upsert that does not supply an _id.
  • Fix upserts by a known _id being rejected with "Field '_id' is not allowed by the schema" when a Zod schema does not declare _id.
  • Rethrow the original error when a write using bypassCollection2 fails, instead of "Cannot determine schema type" (#512).
  • Keep the message and code of the underlying error when a validated write on a Zod or AJV schema fails in Mongo, as SimpleSchema schemas already do, and expose the original error as cause.
  • Reduce the time the Zod adapter spends on each write. It no longer walks parts of a schema that have no defaults or autoValues, and no longer does work that only applied to Zod 3. In local measurements the overhead of inserting a document with a 1000-item array fell from about 30 ms to 1.5 ms, and of a two-field update on a 500-field schema from 1.5 ms to 0.06 ms.