Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Local API: query nested property of nested property

default discord avatar
linobino1last year

I have a collection

screenings

with a relationship to

movies

that has a relationship to

directors

.


Is it possible to get all

screenings

with a movie by a certain

director

?



payload.find({
  collection: 'screenings',
  where: {
    'movie.director': {
      equals: '602c3c327b811235943ee12b,
    },
  },
})


I get this error:


QueryError: The following path cannot be queried: director
    at new ExtendableError (/app/node_modules/payload/src/errors/APIError.ts:26:11)
    at new APIError (/app/node_modules/payload/src/errors/APIError.ts:43:5)
    at new QueryError (/app/node_modules/payload/src/errors/QueryError.ts:8:5)
    at Function.buildQuery (/app/node_modules/payload/src/mongoose/buildQuery.ts:570:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /app/node_modules/payload/src/mongoose/buildQuery.ts:265:30
    at async ParamParser.buildSearchParam (/app/node_modules/payload/src/mongoose/buildQuery.ts:257:35)
    at async ParamParser.parsePathOrRelation (/app/node_modules/payload/src/mongoose/buildQuery.ts:144:35)
    at async ParamParser.parse (/app/node_modules/payload/src/mongoose/buildQuery.ts:117:21)
    at async Function.buildQuery (/app/node_modules/payload/src/mongoose/buildQuery.ts:567:22)


Local API: query nested property of nested property



I opened a github issue now:

https://github.com/payloadcms/payload/issues/2611
    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team..