Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema
https://github.com/Meteor-Community-Packages/meteor-simple-schema
MIT License
919 stars 161 forks source link

Array elements gets truncated #708

Closed DeanKamali closed 6 years ago

DeanKamali commented 6 years ago

Hello everyone,

I'm trying to save an Array, and here is an example

  "procedures": [
    "AK",
    "HI"
  ],

In Schema file, here is what I specified

  procedures: {
    type: Array
  },

it gets saved as an empty array? and none of the elements makes it to DB, why is that?

DeanKamali commented 6 years ago

hmm, after struggle, I found out that I need to do the following:

  procedures: SimpleSchema.oneOf(String, Array),
 'procedures.$': { type: String, optional: true, },