realm-js
realm-js copied to clipboard
Inherit base model in other models
So i read the doc but it didnt help, What i have is a base model which has some common fields and i want to inherit those in my all other models. My Base Model:
class Base { }
Base.schema = {
name: 'Base',
properties: {
uuid: { type: 'string', optional: false },
created_by: { type: 'string', optional: false },
}
};
My Other Model:
class Student { }
Student.schema = {
name: 'Student',
properties: {
name: { type: 'string', optional: false },
age: { type: 'int', optional: true }
...
}
};
Result i want when i create a record:
{
uuid: 'xxx-xxx-xxx-xxx-xxx'
created_by: 'xxx-xxx-xxx-xxx-xxx'
name: 'Smith'
age: 20
...
}
We don't support inheritance at the moment, but for a long time, we have had the wish to do so (see for example https://github.com/realm/realm-java/issues/761).
Hi guys. Haven't you implemented inheritance yet?
@AwanesowArtem Sorry no, and I can't give you a timeline for it.