Skip to content Skip to sidebar Skip to footer

Uncaught Error: When The Modifier Option Is True, Validation Object Must Have At Least One Operator

trying to read between StackOverflow and the documentation of meteor-simple-schema but can't find a solution. I'trying to insert data in the Meteor.users collection through a form.

Solution 1:

Try this schema

Schema.User = new SimpleSchema({
  email: {
    type: Object
  },
  'email.address': {
    type: String,
    optional: true
  },
  "email.verified": {
    type: Boolean,
    optional: true
  },
  profile: {
    type: Schema.UserProfile,
    optional: true
  },
  createdAt: {
    type: Date,
    autoValue: function() {
      if (this.isInsert) {
        return new Date();
      } else if (this.isUpsert) {
        return {$setOnInsert: new Date()};
      } else {
        this.unset();
      }
    }
  }
});

Btw if you are using account-password then this schema won't work as that package expect emails to be stored in a certain way.


Post a Comment for "Uncaught Error: When The Modifier Option Is True, Validation Object Must Have At Least One Operator"