I can't get the Waterline ORM to hydrate my join. https://github.com/balderdashy/waterline-docs
I have the following two models:
// primary model
identity: 'document',
tableName: 'document',
attributes: {
id: {
type: 'integer',
columnName: 'id',
primaryKey: true,
autoIncrement: true
},
// reference other models
data: {
model: 'document_data',
columnName: 'id',
},
},
// related model
identity: 'document_data',
tableName: 'document_data',
attributes: {
documentId: {
type: 'integer',
columnName: 'document_id',
primaryKey: true,
},
body: {
type: 'text',
columnName: 'body',
},
},
I can see the following logged:
MySQL.processChildren:
(SELECT * FROM document_data AS document_data WHERE document_id = 2 ORDER BY document_data.document_id ASC)
This is the correct query and I can confirm in the database.
But the data key is not populated in the document model. It's just an empty object data: {}
Aucun commentaire:
Enregistrer un commentaire