Mengambil data kunci asing dalam sekelompok

Generic :

TableB.belongsTo(models.TableA, { foreignKey: 'someID', targetKey: 'notTableAID' } );

TableA.hasOne(TableB, {
  sourceKey: 'someNonPrimaryKeyColumnOnTheSOurceModel',
  foreignKey: 'matchingColumnOnTheTargetModel'
});



Example : 
// associations
assetAuditSubmissionsModel.hasOne(assetInfoModel, {
  foreignKey: "assetSerialNumber",
  sourceKey: "assetSerialNumber",
});

assetInfoModel.belongsTo(assetAuditSubmissionsModel, {
  foreignKey: "assetSerialNumber",
  targetKey: "assetSerialNumber",
});
Tanishq Vyas