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

AutoValue Doesn't Run On Server #366

Closed mokaid closed 6 years ago

mokaid commented 6 years ago

Hello Guys,

I don't know what is going on what the AutoValue A simple schema file is in common between the server and the client I have autovalue where it runs twice on the client side only and nothing on the server

---> autovalue { if(Meteor.isServer) console.log('server') if(Meteor.isClient) console.log('client') } result : client , client

Am i missing anything or this is a normal behavior of the autovalue, please advice

aldeed commented 6 years ago

Running twice on the client is a bug that will be fixed shortly. But it should run once on the server. It runs on the client just for validation purposes but the actual stored values are the ones generated when it runs on the server.

If this is still an issue, please post a link to a simple reproduction app.