Adonis Query Builder: How to make .where condition on relationship #1314
Unanswered
kempsteven
asked this question in
Help
Replies: 2 comments
-
I think the queries are run one at a time, and consequently, you won't be able to do that. But what you can do is to filter the list of orders returned at the application level. Something like the snippet below should be fine: const orders = await Order.query().with('order_status');
return orders.filter(order=>order.order_status.is_completed_type); However, this solution won't be appropriate without further tweaking if you are paginating your response |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have this query
I want to only get the orders with order_status.is_completed_type === true
but it seems that doesn't work that way, is there a way to do this?
Beta Was this translation helpful? Give feedback.
All reactions