Skip to content

Conversation

@PatrikKozak
Copy link
Contributor

@PatrikKozak PatrikKozak commented Apr 8, 2025

What?

This PR addresses a bug where relationship fields with hasMany: false (including polymorphic relationships) allowed filtering using the in and not in operators via the Admin UI, which led to query errors.

Why?

MongoDB & Postgres expect an array when using in & not in, but these fields return a single object (not an array).

How?

  • in and not in operators are now excluded from the list of available filter operators for relationship fields where hasMany: false.

Fixes #12014

@tyteen4a03
Copy link
Contributor

I don't think this behavior is correct.

I want to still be able to query many items based on the value of a relationship array (e.g. Item 1 with owner A, item 2 with owner B, item 3 with owner C. I should be able to specify where[owner.value][in]=A ). I think the solution here is instead making sure ins get turned into array of length 1 correctly.

@PatrikKozak
Copy link
Contributor Author

PatrikKozak commented Apr 8, 2025

@tyteen4a03 I see what you're saying and I agree. Noticing there are some discrepancies with using the in operator in general. I'm looking into it.

@paulpopus
Copy link
Contributor

Closing this PR as it's not the right solution, more info in a follow up PR to be linked to #12014

@paulpopus paulpopus closed this Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Querying where[field.value][in] on polymorphic relationships break when only 1 value is specified

4 participants