我有一个数据库,其代码如下:
realm = new Realm({
path: 'DeviceDB.realm',
schema: [
{
name: 'Schedule',
primaryKey: 'id',
properties: {
id: 'int',
startingTime: 'string',
endingTime: 'string'
},
},
{
name: 'user_devices',
primaryKey: 'id',
properties: {
id: 'int',
schedules: 'Schedule[]',
dev_name: 'string',
dev_serial: 'string'
},
},
],
});
但是当我尝试获取时间表时,它返回undefined
。任何想法怎么了
const devs = realm.objects('user_devices').filtered('id =' + this.state.deviceId);
const fetched_schedules = devs.schedules;
deviceId
处于我的状态,我检查了它的正确性。