Strapi v4 querying models like v3

  • Strapi Version: Strapi v4
  • Operating System: Mac
  • Database: Postgres
  • Node Version: 14.16.0
  • NPM Version: 6.14.11

So we’ve been using strapi v3 for quite many years and are now migrating our app to v4.

In v3 we could use bookshelf query builder to build our apis e.g. as per the v3 docs here Backend customization - Strapi Developer Documentation

const result = await strapi
  .query('restaurant')
  .model.query(qb => {
    qb.where('id', 1);
  })
  .fetch();

We’re using such queries to a very complex with multiple joins and selects within a query in our backend to implement custom apis. But I’m not able to use this bookshelf query builder in v4. Am I missing something here? Or is it not supported at all?

Any help/guidance will be appreciated.


1 Like

bookshelf is repaced with knex in v4

1 Like