You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error can be tracked down to the result on line 117 packages/db-mongodb/src/find.ts.
This result is generated with packages/db-mongodb/src/utilities/buildJoinAggregation.ts and within here I believe we are querying incorrectly. Unsure of the fix, it might be version compatibility or needing to append the query with $expr.
### What?
Fixes the issue with `in` querying when the collection has a join field.
### Why?
When using `.aggregate`, MongoDB doesn't cast a comma delimited value
for the `$in` operator to an array automatically as it's not handled by
Mongoose.
### How?
Sanitizes the incoming value to an array if it should.
Fixes#8901
Describe the Bug
This is the underlying issue for bug #8836.
The following request fails when there is more than one id.
Fails (returns 0 docs):
Works (returns 1 doc):
The error can be tracked down to the result on line 117
packages/db-mongodb/src/find.ts
.This result is generated with
packages/db-mongodb/src/utilities/buildJoinAggregation.ts
and within here I believe we are querying incorrectly. Unsure of the fix, it might be version compatibility or needing to append the query with$expr
.Link to the code that reproduces this issue
branch
issue/join-query
(https://github.com/payloadcms/payload/tree/issue/join-query)Reproduction Steps
pnpm dev joins
untitled
untitled
Which area(s) are affected? (Select all that apply)
db-mongodb
Environment Info
Payload: beta@latest
Node.js: v20.9.0
Next.js: v15.0.0
The text was updated successfully, but these errors were encountered: