mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
Fix buildQuery for polymorphic relations
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
This commit is contained in:
parent
e1e2dd3419
commit
07c38420d4
@ -167,7 +167,7 @@ const buildDeepQuery = ({ model, filters, search, populate }) => {
|
||||
$in: ids,
|
||||
},
|
||||
},
|
||||
null,
|
||||
null
|
||||
)
|
||||
.populate(populate);
|
||||
|
||||
@ -445,12 +445,14 @@ const buildLookupMatch = ({ assoc, assocModel, filters = {} }) => {
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
$expr: {
|
||||
$and: defaultMatches.concat(
|
||||
{ $eq: [`$${assoc.via}.ref`, '$$localId'] },
|
||||
{ $eq: [`$${assoc.via}.${assoc.filter}`, assoc.alias] }
|
||||
),
|
||||
},
|
||||
$and: defaultMatches.concat({
|
||||
$expr: {
|
||||
$and: [
|
||||
{ $eq: [`$${assoc.via}.ref`, '$$localId'] },
|
||||
{ $eq: [`$${assoc.via}.${assoc.filter}`, assoc.alias] },
|
||||
],
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user