How to use the strapi-utils.buildQuery function in strapi-utils

To help you get started, we’ve selected a few strapi-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi-connector-mongoose / lib / queries.js View on Github external
function count(params) {
    const filters = convertRestQueryParams(params);

    return buildQuery({
      model,
      filters: { where: filters.where },
    }).count();
  }
github strapi / strapi / packages / strapi-hook-mongoose / lib / queries.js View on Github external
function find(params, populate) {
    const populateOpt = populate || defaultPopulate;

    const filters = convertRestQueryParams(params);

    return buildQuery({
      model,
      filters,
      populate: populateOpt,
    });
  }
github jbeuckm / strapi-plugin-import-content / config / queries / bookshelf.js View on Github external
count: async function(params = {}) {
    const model = this;

    const { where } = convertRestQueryParams(params);

    return this.query(buildQuery({ model, filters: { where } })).count();
  },
github strapi / strapi / packages / strapi-admin / config / queries / mongoose.js View on Github external
find: async function(params, populate) {
    const model = this;
    const filters = convertRestQueryParams(params);

    return buildQuery({
      model,
      filters,
      populate: populate || model.associations.map(x => x.alias),
    }).lean();
  },
github strapi / strapi / packages / strapi-connector-mongoose / lib / queries.js View on Github external
function find(params, populate) {
    const populateOpt = populate || defaultPopulate;

    const filters = convertRestQueryParams(params);

    return buildQuery({
      model,
      filters,
      populate: populateOpt,
    }).then(results =>
      results.map(result => (result ? result.toObject() : null))
    );
  }
github strapi / strapi / packages / strapi-admin / config / queries / mongoose.js View on Github external
count: async function(params) {
    const model = this;

    const filters = convertRestQueryParams(params);

    return buildQuery({
      model,
      filters: { where: filters.where },
    }).count();
  },
github strapi / strapi / packages / strapi-hook-mongoose / lib / queries.js View on Github external
function count(params) {
    const filters = convertRestQueryParams(params);

    return buildQuery({
      model,
      filters: { where: filters.where },
    }).count();
  }
github strapi / strapi / packages / strapi-admin / config / queries / bookshelf.js View on Github external
count(params = {}) {
    const { where } = convertRestQueryParams(params);

    return model.query(buildQuery({ model, filters: { where } })).count();
  },
github strapi / strapi / packages / strapi-hook-bookshelf / lib / queries.js View on Github external
function count(params = {}) {
    const { where } = convertRestQueryParams(params);

    return model.query(buildQuery({ model, filters: { where } })).count();
  }