class Parameters extends Realm.Object<Parameters> {
param_id?: string;
param_value?: string;
param_name?: string;
static primaryKey = 'param_id';
constructor(realm: Realm) {
super(realm, {});
}
}
class Tags extends Realm.Object<Tags> {
tag_name?: string;
constructor(realm: Realm) {
super(realm, {});
}
}
class Contacts extends Realm.Object<Contacts> {
id?: string;
whatsapp_availability?: string;
projectId?: string;
is_subscribed?: boolean;
candidate_id?: string;
contact_name?: string;
phoneNumber?: string;
created_at?: Date;
tags?: Realm.List<Tags> | [];
parameters?: Realm.List<Parameters> | [];
static primaryKey = 'id';
constructor(realm: Realm) {
super(realm, {});
}
}
I have contacts array with nested objects.When i try to insert to contacts table its not automatically getting inserted to parameters array useing below fn.
realm.write(() => {
realm.delete(realm.objects('Parameters'))
const contact = realm.create(
'Contacts',
{
whatsapp_availability: props.whatsapp_availability,
projectId: props.projectId,
id: props.id,
is_subscribed: props.is_subscribed,
candidate_id: props.candidate_id,
contact_name: props.contact_name,
phoneNumber: props.phoneNumber,
created_at: new Date(props.created_at),
parameters: props?.parameters,
tags: props?.tags,
},
'modified',
);
ALso please guide me on how to retrieve the contacts list along with respective parameters, tags array
Thanks