Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema

Home Page:https://github.com/Meteor-Community-Packages/meteor-simple-schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array elements gets truncated

DeanKamali opened this issue · comments

commented

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?

commented

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

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