Filtering with multiple ANDs and ORs causing issues with Left Join #5086
-
Hey, I'm just running a query and it's operating in unexpected ways. There are two entities involved:
It is executing using the query builder with the code below:
The debugger is building this query:
It's throwing this error.
As you can see one of the fieldB columns is being mapped to I reproduced it here: https://github.com/keithintegral/reproduction/blob/6baa7281a602b17dd99245f28cc966a86c8ec8a7/src/example.test.ts#L152
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Looks like the problem is caused by querying the PK instead of the FK: {
fieldB: {
- id: {
- $nin: [
- 'randomId1',
- ],
- },
+ $nin: [
+ 'randomId1',
+ ],
},
}, Btw you forgot to await the QB in your repro, so edit: also the nested |
Beta Was this translation helpful? Give feedback.
Looks like the problem is caused by querying the PK instead of the FK:
Btw you forgot to await the QB in your repro, so
results
is a promise and you serialize it so you get{}
regardless of the actual query/result.edit: also the nested
$and
placed inside a relation property condition is causing this, if I remove the top level$and
(or the nested$or
) it's also working fine (even without the change above)