My update method is passing the simple-schema validation test however it isn't updating my collection. I'm updating an array of objects.
Example: array
var arrayTest = [
{
company: 'sdsd',
uniqueId: 1500431892902,
title: '',
description: '',
startDateMonth: '',
startDateYear: '',
endDateMonth: '',
endDateYear: '',
isCurrent: false,
isDisabled: false,
}
];
Validate: Array
new SimpleSchema({
company: { type: String, optional: true },
uniqueId: { type: Number, optional: true },
title: { type: String, optional: true },
description: { type: String, optional: true },
startDateMonth: { type: String, optional: true },
startDateYear: { type: String, optional: true },
endDateMonth: { type: String, optional: true },
endDateYear: { type: String, optional: true },
isCurrent: { type: Boolean, optional: true },
isDisabled: { type: Boolean, optional: true }
}).validate(
arrayTest
);
Update: Collection
ProfileCandidate.update({
_id: "BoDb4Zztq7n3evTqG"
}, {
$set: {
careerHistoryPositions: arrayTest
}
}, (error, result) => {
if (error) {
console.log("error: ", "error");
}
if (result) {
console.log("result", result);
}
});
The update appears to work however no data goes into the schema.