I have a realm db schema like shown below.
const ParentSchema = {
name: 'parent',
properties: {
id: 'string',
father_name: 'string',
children: { type: 'linkingObjects', objectType: 'child', property: 'parent' },
},
primaryKey: 'id',
};
const ChildSchema = {
name: 'child',
properties: {
id: 'string',
first_name: 'string',
parent: { type: 'parent' },
},
primaryKey: 'id',
};
First i want to know if its ok for parent child relationship? i need parents with their childs and child with parent.
The issue is when i get child i get list of children with his parent and parent has again a list of children and childeren has parent and again parent has children. and this goes so on..
Same this applies when i get list of parents.
let data = realm.objects('parent');