Skip to content

fix(db-mongodb): bug resolving joins when useJoinAggregations is disabled #13573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rubn-g
Copy link

@rubn-g rubn-g commented Aug 24, 2025

What?

When using MongoDB adapter, with the option useJoinAggregations set to false, queries containing multiple joins were only executing the first join

When useJoinAggregations is disabled and a join includes multiple collections, only first was included.

For example, if we have this json query where (simplified real use case from the Folders feature), only the payload-folders join where processed.

{
  "or": [
    {
      "and": [
        {
          "relationTo": {
            "equals": "payload-folders"
          }
        }
      ]
    },
    {
      "and": [
        {
          "relationTo": {
            "equals": "media"
          }
        }
      ]
    }
  ]
}

Fixes

Go through multiple or and and operators in a query where, looking for the relationTo property, instead of keeping the first one found.

@rubn-g rubn-g changed the title fix(db-mongodb): Bug resolving joins when useJoinAggregations is disabled fix(db-mongodb): bug resolving joins when useJoinAggregations is disabled Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant