- framework feathers ^ 2.2.3
- ORM sequelize (feathers-sequelize ^ 2.3.2)
- MySQL database
- 2 tables between which you need to organize a connection
in the category.model.js file I describe the link:
category.associate = function (models) { models.category.belongsTo(models.category_translate, { foreignKey: 'id', constraints: false, targetKey: 'category_id', as: 'translate' }); }; Now, if you contact the address localhost:3030/category then the result of this query is displayed:
SELECT `id`, `icon`, `parent` FROM `category` AS `category` LIMIT 10; I tried localhost:3030/category?$select[]=translate to access the fields from the linked table, but an error occurred.
What am I doing wrong?
How to access data from another table by linking from the current model?