dataloader-sequelize: .paired missing on belongsToMany association
Hi,
Not sure whether my setup or association definition is off, but it seems to work fine without dataloader-sequelize
.
I have the following “user/friends” association:
User.belongsToMany(User, {as: "friends", through: "Friends"});
This works:
const user = await User.findById(1);
const friends = await user.getFriends();
console.log(`You have ${friends.length} friend(s).`);
However, adding dataloader-sequelize
to the mix:
dataloaderSequelize(User);
...
...
Yields the following error:
AssertionError: .paired missing on belongsToMany association. You need to set up both sides of the association.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 18 (4 by maintainers)
I know, I have copied the existing tests and modified the sequelize models.
On Sat, 15 Jun 2019, 20:05 Mick Hansen, notifications@github.com wrote:
Sounds good to me @kfrajtak, PR welcome
ok i think i solved it with this.