Realm object field using default value based on another field

52 Views Asked by At

When using an arrow function as default value in the Realm schema definition, is there a way to access a value defined in another field from this function ?

Because I have 2 IDs fields in my objets and they must be the same at creation (and then after updates only one is changing).

So I would like to achieve something like :

rowId: { type: 'uuid', default: () => new BSON.UUID() }
branchId: { type: 'uuid', default: () => this.rowId }, // error because _this_ is not the realm object...`
0

There are 0 best solutions below