Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema
https://github.com/Meteor-Community-Packages/meteor-simple-schema
MIT License
919 stars 161 forks source link

exception thrown when pick schema #713

Closed veyronfei closed 6 years ago

veyronfei commented 6 years ago
code 1. ASchema = new SimpleSchema([{
  a: {
    type: String,
    custom: function() {},
  }
}]);

code 2. BSchema = ASchema.pick(['a']);

Because I don't need custom in BSchema, so I add a line:

code 3. BSchema._schema.a.custom = undefined;

But the following code4 will throw exception

code 4. CSchema = BSchema.pick(['a']);

Error: Invalid definition for a field.

But if I put code 3 below code 4, everything works fine.

May I ask why it throws an exception? and what is the best way to do code 3?

aldeed commented 6 years ago

The Meteor SimpleSchema package is no longer maintained other than critical fixes to keep it running with each latest Meteor release. Closing non-critical issues in this repo. Anyone who cares about this may do one or more of the following: