Merge pull request #8866 from strapi/rf/fix-mongo-many-many-preview

Fix many-many preview with mongo
This commit is contained in:
Alexandre BODIN 2020-12-11 09:47:12 +01:00 committed by GitHub
commit e8a016be55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,8 +293,9 @@ module.exports = {
assoc.targetUid
);
} else {
const assocModel = strapi.db.getModelByAssoc(assoc);
relationList = await entityManager.findPage(
{ page, pageSize, [assoc.via]: entity.id },
{ page, pageSize, [`${assoc.via}.${assocModel.primaryKey}`]: entity.id },
assoc.targetUid
);
}