SimpleSchema how can I require arrays to have at least one element? [SOLVED]


#1

I need the arrays to have at least one element.
The following Schema does not work:

let schema = new SimpleSchema({
  levels: { 
    type: [String], 
    min: 1,
    allowedValues: ['basic', 'intermediate', 'advanced'] 
  },
  preferences: { 
    type: [String], 
    min: 1,
    allowedValues: ['TheSimpsons', 'Naruto'] 
  }
});

#2

I solved it with minCount instead of min.