Skip to content

Filtering with multiple ANDs and ORs causing issues with Left Join #5086

Answered by B4nan
keithintegral asked this question in Q&A
Discussion options

You must be logged in to vote

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 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)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@B4nan
Comment options

@keithintegral
Comment options

@B4nan
Comment options

@B4nan
Comment options

@B4nan
Comment options

Answer selected by keithintegral
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants