Aggregation queries

System Information
  • Strapi Version: 4.7.1+
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hi all! I use strapi to create a marketplace. I found that there are no aggregation functions in queries. This makes it difficult to use strapi for more or less serious projects.
Even in google sheets you can use formulas like =QUERY($A:$D; “select D, COUNT(D) where(B=‘Seen’) group by D limit 10”).
I’m sure there must be some way out. Tell him please?

You might make use of count?

const count = await strapi.db.query('api::blog.article').count({
  where: {
    title: {
      $startsWith: 'v3',
    },
  },
});

However for more aggregate-Functions there’s a PR that might come in near future.

Cheers,
Olaf

Thanks
yes i know. But i need SUM )

What is PR?

In the documentation limit and start with what you can paginate CRUD operations | Strapi Documentation