Meteor-Community-Packages / meteor-collection2

A Meteor package that extends Mongo.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating.
https://packosphere.com/aldeed/collection2
MIT License
1.02k stars 108 forks source link

Migration from Meteor 1.4 to 1.9, Collection 2 from 2.10 to 3.0, SimpleSchema with meteor-collection2 error on unique option #411

Closed hebrides closed 4 years ago

hebrides commented 4 years ago

Migrating app from Meteor 1.4 to 1.9. Trying to migrate meteor-collection2 to v. 3.0.6. SimpleSchema no longer recognizes meteor-collection2 unique option. Old versions that work:

aldeed:collection2@2.10.0
aldeed:autoform@5.8.1
aldeed:simple-schema@1.5.4

New versions that don't:

aldeed:collection2@3.0.6  // with `simpl-schema` in package.json 
aldeed:autoform@6.3.0
aldeed:simple-schema@1.5.4    

With this code:

Users = Meteor.users;
UserProfileSchema = new SimpleSchema({
    phone: { type: String, label: "Phone Number", min: 9, max: 15, unique: true },

SimpleSchema error:

Error: Invalid definition for phone field: "unique" is not a supported property
copleykj commented 4 years ago

Is there any way you could provide a minimal reproduction for this issue?

CaptainN commented 4 years ago

Have you tried meteor add aldeed:schema-index? Also, can you paste your entire .meteor/packages file here? (also, you shouldn't have aldeed:simple-schema installed - use the npm module instead meteor npm i simpl-schema.)

StorytellerCZ commented 4 years ago

Did encounter something similar yesterday, you need to manually add aldeed:schema-index and possibly aldeed:schema-deny if you are using that functionality.

https://github.com/aldeed/meteor-schema-index/pull/24