A Meteor package that extends Mongo.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating.
No changes, but aldeed:collection2
is now a shell package that installs three component packages: aldeed:collection2-core
, aldeed:schema-index
, and aldeed:schema-deny
denyInsert
and denyUpdate
to stop working. If using SimpleSchema v1.4.0 or higher, be sure to use Collection2 v2.7.1 or higher._id
is required in the schemaEven if you skip all validation and cleaning, Collection2 will still do some object parsing that can take a long time for a large document. To bypass this, you can now set the bypassCollection2
option to true
when you call insert
or update
. This works only in server code.
docId
is now set in the autoValue and custom contexts for inserts, too, if possiblevalidationContext
option can now be a reference to a context instead of a string nameupsert
method instead of {upsert: true}
option.sparse
option which can be set to true
along with index
option to force a sparse indexUse latest simple-schema version
docId
in autoValue
and custom
contexts when provided as non-object. (Thanks @FatBoyXPC)Fix handling of _id property on client to match server.
You can now pass an extendedCustomContext
option when calling insert or update. Set this to an object that will be used to extend this
within any custom validation functions that are called.
You can now pass an extendAutoValueContext
option when calling insert or update. Set this to an object that will be used to extend this
within any autoValue functions that are called.
Note that the extendedCustomContext
and extendAutoValueContext
options will work fine for calls in server code or calls against local (unmanaged) collections in client code, but they will not work with calls against normal (managed) collections in client code. When the second round of validation happens on the server, your custom contexts will not be set.
Also: When a validation error
is passed to the insert
or update
callback, error.validationContext
is now set to the validation context that was used.