我的更新方法经过简单模式验证测试但它没有更新我的收藏。 我更新对象的数组。
例如: array
var arrayTest = [
{
company: 'sdsd',
uniqueId: 1500431892902,
title: '',
description: '',
startDateMonth: '',
startDateYear: '',
endDateMonth: '',
endDateYear: '',
isCurrent: false,
isDisabled: false,
}
];
验证: 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
);
更新: Collection
ProfileCandidate.update({
_id: "BoDb4Zztq7n3evTqG"
}, {
$set: {
careerHistoryPositions: arrayTest
}
}, (error, result) => {
if (error) {
console.log("error: ", "error");
}
if (result) {
console.log("result", result);
}
});
更新似乎工作但没有数据进入的模式。