Open louy opened 8 years ago
It's probably here.
I previously added support for mapsTo
and then patched some bugs related to it. I don't remember patching the findBy
function though.
Doesn't it mean that the issue is that association.model.id
(or maybe association.field
) is incorrectly set?
I'm not sure what mapsTo
stands for.
Setting orm.settings.set('properties.primary_key', '_id')
won't help you here. It's just the name of the default primary key property that's added to models if you don't add one yourself.
Since you have id: { type: 'text', key: true, size: 100 }
, you need to tell ORM that the column in the database has a different name. You can do this by adding mapsTo
. So id
in the model mapsTo
_id
in the table.
id: { type: 'text', key: true, size: 100, mapsTo: '_id' }
That said, im not sure if that'll fix your problems as I can't remember if I ever fixed finyBy..
so that it supports mapsTo
.
@dxg it seems to be not fixed. findBy...
can't supports mapsTo
yet
I opened an issue on #817 about this problem. Please check this :(
I've been getting the following error when using
findByAssociation
:The main reason is that I have
orm.settings.set('properties.primary_key', '_id');
while in one table, I haveid: { type: 'text', key: true, size: 100, },
. I'm not sure where the issue is but it's probably in the mysql driver.