-
-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Labels
Description
I have the following key in my schema:
priceInfo: {
type: SimpleSchema.oneOf(Object, Number),
blackbox: true,
optional: true
}In my app I have the following "upsert" logic:
if (this.currentPrice && this.currentPrice.isPromo) {
let $setPrice = { priceInfo: price };
if(typeof unit == 'string') {
$setPrice = { [`priceInfo.${unit}`]: price };
}
Prices.update({ _id: this.currentPrice._id }, { $set: $setPrice })
} else {
let priceInfo = price;
if(typeof unit == 'string') {
priceInfo = {};
priceInfo[unit] = price;
}
Prices.insert({
itemId: item._id,
supplierId: currentSupplier._id,
updated_at: new Date(),
priceInfo,
validity: {
promoId: listId
}
});
}This completely breaks it, as no update is possible with the following error:
Uncaught Error: After filtering out keys not in the schema, your modifier is now empty
Can anyone help? My code is correct (I think), without the schema everything works just fine.
best, Patrick