How to add a nested List of objects in Realm “Error: JS value must be of type: object”

北战南征 提交于 2019-12-04 20:13:48

U have to specify the index of the record. As exercise.returns a record not an exercise object

try this instead

realm.write(() => {
    let exercise = realm.create('Exercise', {
        id: 209,
        name: 'Dumbbell Overhead Press',
        category: 'Military Press',
        bodyPart: 'Shoulder'
    }, true);
    exercise[0].levels.push({
        level: 3,
        equipments: 'DB'
    });

});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!