Find by nested object v4

System Information
  • Strapi Version: 4.10.1
  • Operating System: MacOS
  • Database: MariaDB
  • Node Version: 18.16.0
  • NPM Version: 9.5.1
  • Yarn Version:

Hi there,
I’d like to ask that I need to filter my object by nested object with Service API or Query API. I have two object like that: Project > Task. There is a many2one relation between them and I’d like to search Task object by Project ID.
I’ve tried with this snippet but didn’t get any resultset.

const entries = await strapi.db.query('api::task.task').findMany({
            where: {
                project: {
                    id: projectId,

please use the entity service and not the query engine also to me this looks like it should work
Are you sure your projectId is correct?

1 Like