Skip to content

Commit

Permalink
reset
Browse files Browse the repository at this point in the history
  • Loading branch information
r1tsuu committed Jan 6, 2025
1 parent a5d4f36 commit 851efba
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/db-mongodb/src/utilities/buildJoinAggregation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,15 @@ export const buildJoinAggregation = async ({
}
})
} else {
const path =
join.field.localized && adapter.payload.config.localization && locale
? join.getLocalizedPath(locale)
: join.field.on

const as = `${versions ? `version.${join.joinPath}` : join.joinPath}${path}`
const localeSuffix =
join.field.localized && adapter.payload.config.localization && locale ? `.${locale}` : ''
const as = `${versions ? `version.${join.joinPath}` : join.joinPath}${localeSuffix}`

aggregate.push(
{
$lookup: {
as: `${as}.docs`,
foreignField: `${path}${polymorphicSuffix}`,
foreignField: `${join.field.on}${localeSuffix}${polymorphicSuffix}`,
from: adapter.collections[slug].collection.name,
localField: versions ? 'parent' : '_id',
pipeline,
Expand Down

0 comments on commit 851efba

Please sign in to comment.