You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package on it's own is meant to be very generic, so that it can be used to enforce schema for any javascript object, not necessarily related to a collection at all.
If you want to tie the schema to a collection, you'll have to write a bunch of code that would end up being the same as the code in the collection2 package, so you should just use collection2. Otherwise, the simplest way to use it without collection2 would be to:
Use deny functions to deny all inserts and updates from the client.
Create server methods that you can call from the client to do inserts, etc. Pass your insert doc or update modifier to these methods.
In the insert server method, call check(doc, mySimpleSchema) to make sure the doc to be inserted matches the schema. Then perform the insert on the server.
In the update server method, call check(modifier, mySimpleSchema) to make sure the modifier for the update matches the schema. Then perform the update on the server.
Hello,
I think I am missing something. Where do you create your collection and how do you tie it to the schema? (without using collection2)
Thanks
The text was updated successfully, but these errors were encountered: