Closed AhsanAyaz closed 7 years ago
wow totally missed this until now at least now i know there's something to do maybe we'll look at it within next 30 days cc @aquid
@AhsanAyaz While this is really a bug and thank you for reporting this issue, but your query seems a bit confusing to me, can you improve it with something like this(just suggesting where section) ?
"where": {
"and": [
{
"type": "email"
}
{
"enterprise_id": "897cxzasdjhjhaz897"
},
{
"or": [
{
"fromUserId": "12321312n3nkb"
},
{
"toUserIds": "89789z7xc8z7xc87sad"
}
]
}
]
}
OR maybe like this
"where": {
"or": [
{
"type": "email",
"enterprise_id": "897cxzasdjhjhaz897",
"fromUserId": "12321312n3nkb"
},
{
"type": "email",
"enterprise_id": "897cxzasdjhjhaz897",
"toUserIds": "89789z7xc8z7xc87sad"
}
]
}
Maybe this is not useful to you, I just wanted to display other possibilities or understand any specific reason for this query format.
I will soon look into your PR but before that can you add some test cases too? That will make sure that we don't mess it again with coming updates.
It is day 30, i think ... doing a shallow review.
@pulkitsinghal
Thank you for reviewing. Here's the updated latest PR with test cases required. I had to use the plugin with the fixes for a complex webapp so I published a temporary package under my namespace @ahsanayaz
and using it for now.
It'll be really helpful if this can be reviewed and merged :)
Thanks 👍
fixed and released in v1.4.1 - Jun 6, 2017
I have a loopback query like:
This actually creates a query :
Since it is an AND and inside that there's an OR which is not at root level so what the following code of library does is that it appends the array of OR items inside the AND without
bool
andshould
and therefore returns an empty array:So i've changed that inside my code to
Which generates correct query :
The above query returns the data perfectly.
My question is Is this the right way to resolve this issue? I'm assuming that if orPath was used, it would've been used for some reason. But in the case of AND, the
andObject
is used and not theandPath
.Any suggestions? If that is the right way of doing it what I did, i'll create a PR then.