Memberships.upsert({userId: this.userId}, {
$push: {portalAccess: newInfo.portalAccess}
});
The code above is from my ValidatedMethod, where I am trying to push a new array element (i.e. portalAccess) into the Memberships schema, which is like this:
Memberships.schema = new SimpleSchema({
userId:{
type: String,
regEx: SimpleSchema.RegEx.Id
},
portalAccess:{
type:[Object]
},
..more portalAccess.$.xyz definitions here
However, on running validate
before I do run.call
, I get
exception: Portal access must be an array [validation-error]
My question is why? Shouldn’t the $push call just push the new element into the array?