diff --git a/packages/strapi-hook-bookshelf/lib/buildQuery.js b/packages/strapi-hook-bookshelf/lib/buildQuery.js index 12dc60eacc..28b18a1652 100644 --- a/packages/strapi-hook-bookshelf/lib/buildQuery.js +++ b/packages/strapi-hook-bookshelf/lib/buildQuery.js @@ -23,7 +23,7 @@ const buildQuery = ({ model, filters }) => qb => { let fieldKey = `${associationModel.collectionName}.${attributeKey}`; - if (association && attributeKey === whereClause.field) { + if (association && attributeKey === field) { fieldKey = `${associationModel.collectionName}.${associationModel.primaryKey}`; } diff --git a/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js b/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js index 6084b34868..87fdb0bae9 100644 --- a/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js +++ b/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js @@ -217,7 +217,7 @@ describe('Test Graphql Relations API End to End', () => { createDocument: { document: { ...selectFields(document), - labels: data.labels.map(selectFields), + labels: expect.arrayContaining(data.labels.map(selectFields)), }, }, },