Closed dominikzogg closed 10 months ago
I think the correct operator to use here would be in
. I have been trying to diagnose what changed with contains
though too.
Yeah you should use in
instead of contains
, I am going to close this issue out. Thanks!
@JarrodMFlesch thank you
@JarrodMFlesch i still the the same error
?depth=0&where[children][in]=64d5ef3b02daa9eb18051754&page=1&limit=1
TypeError: Cannot read properties of undefined (reading 'read')
at /app/node_modules/payload/src/database/queryValidation/validateSearchParams.ts:140:37
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async validateSearchParam (/app/node_modules/payload/src/database/queryValidation/validateSearchParams.ts:178:3)
at async Promise.all (index 0)
at async validateQueryPaths (/app/node_modules/payload/src/database/queryValidation/validateQueryPaths.ts:85:5)
at async find (/app/node_modules/payload/src/collections/operations/find.ts:137:7)
at async findHandler (/app/node_modules/payload/src/collections/requestHandlers/find.ts:30:20)
@dominikzogg Ah yes, sorry for closing too soon. The fix is in this PR.
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.
Link to reproduction
No response
Describe the Bug
This query worked in v1, but does not in v2:
?depth=0&where[children][contains]=64d5ef3b02daa9eb18051754&page=1&limit=1
children is a one to many relation to the same content type (self referencing)
To Reproduce
Try todo a where contains on a field which is a one2many relation pointing on it self
Payload Version
2.0.13
Adapters and Plugins
mongodb