0
我试图将我的思想从理性数据库转移到领域,我有一个小问题。实现插入简单的关系模型(嵌套对象)
我有2个数据模型:
Station.schema = {
name: 'Station', primaryKey: 'id', properties:{ id: 'int', // primary key stationName : {type: 'string'}, stationType : {type:'StationType'} }
}
StationType.schema = {
name: 'StationType', primaryKey: 'id', properties:{ id: 'int', // primary key typeName : {type: 'string'}, }
}
我试图插入对象“station”的新记录,该记录具有名为“stationType”的对象属性。 stationType对象预填充了固定值。
每当我执行插入的对象“站”时,它会尝试插入已存在的“stationType”属性的值。
如何防止插入对象属性?我只希望“stationType”属性指向“StationType”模型中的记录。
谢谢
尤瓦
感谢。 我意识到'真实'的论点,但它不觉得这是我应该用在这种情况下。 你能解释更多关于第二种选择吗?你是否提到类型更新? – Yuval
希望我的编辑帮助。 – EpicPandaForce
清除,谢谢! – Yuval