SchemaField with increasable max?

I'm trying to understand the new schema fields and have a situation where I sometimes want to increase the "max" value of a field. Is that possible? I have this
schema.carryLoad = new fields.SchemaField({
value: new fields.NumberField({
...requiredInteger,
initial: 0,
}),
min: new fields.NumberField({
...requiredInteger,
initial: 0
}),
max: new fields.NumberField({
...requiredInteger,
initial: 0,
})
});
schema.carryLoad = new fields.SchemaField({
value: new fields.NumberField({
...requiredInteger,
initial: 0,
}),
min: new fields.NumberField({
...requiredInteger,
initial: 0
}),
max: new fields.NumberField({
...requiredInteger,
initial: 0,
})
});
but it seems I cannot increase the max value via carryLoad.max += 10 for example
2 Replies
Zhell🎄
Zhell🎄•7mo ago
That is because to change a property of a document, you need to perform an actual update that gets persisted to the database.
await actor.update({"system.carryLoad.max": actor.system.carryLoad.max + 10});
await actor.update({"system.carryLoad.max": actor.system.carryLoad.max + 10});
bluegreymouse
bluegreymouseOP•7mo ago
yup that explains it! thanks đź‘Ť
Want results from more Discord servers?
Add your server