diff --git a/packages/strapi-plugin-upload/config/queries/bookshelf.js b/packages/strapi-plugin-upload/config/queries/bookshelf.js index a216816473..f5efcaabd4 100644 --- a/packages/strapi-plugin-upload/config/queries/bookshelf.js +++ b/packages/strapi-plugin-upload/config/queries/bookshelf.js @@ -3,8 +3,16 @@ const _ = require('lodash'); module.exports = { find: async function (params = {}, populate) { const records = await this.query(function(qb) { - _.forEach(params.where, (where, key) => { - qb.where(key, where[0].symbol, where[0].value); + Object.keys(params.where).forEach((key) => { + const where = params.where[key]; + + if (Array.isArray(where.value)) { + for (const value in where.value) { + qb[value ? 'where' : 'orWhere'](key, where.symbol, where.value[value]); + } + } else { + qb.where(key, where.symbol, where.value); + } }); if (params.sort) {