Shaun Byrnes
08/29/2024, 6:30 AMRequestMalformed: Request failed with HTTP code 400 | Server said: Multiple references found to sort by on `userFood.dateLastUsed`.
Shaun Byrnes
08/29/2024, 6:32 AMShaun Byrnes
08/29/2024, 6:37 AMShaun Byrnes
08/29/2024, 6:37 AMShaun Byrnes
08/29/2024, 6:51 AM"filter_by": "$userFood(userId:RrLJVnXTyIRLGTNlp6rZB89hqQ03) && $userFood(addedToMeals:Breakfast)",
Where we had to put each join collection separately.
If I change to this "filter_by": "$userFood(userId:RrLJVnXTyIRLGTNlp6rZB89hqQ03 && addedToMeals:Breakfast)",
Seems to work (ie multiple references of X).
As you now support $joinCollection(condition)
in the syntax it seems?Kishore Nallan
08/29/2024, 6:51 AMHarpreet Sangar
08/29/2024, 7:16 AM"filter_by": "$userFood(userId:RrLJVnXTyIRLGTNlp6rZB89hqQ03 && addedToMeals:Breakfast)",
was always supported.
Multiple references found to sort by on `userFood.dateLastUsed`.
This error message is returned when a particular doc has multiple references to the joined collection. For example:
Orders.product_ids
references Products.id
, you cannot specify Products
field in sort_by
like:
collection: Orders
q: *
filter_by: $Products(id: *)
sort_by: $Products(price:desc)
because we cannot decide the sort order using product prices since multiple products are related to an order.Harpreet Sangar
08/29/2024, 7:18 AMShaun Byrnes
08/29/2024, 7:23 AM"filter_by": "$userFood(userId:RrLJVnXTyIRLGTNlp6rZB89hqQ03) && $userFood(addedToMeals:Breakfast)",
, has been this way in our code since ages ago - before there was even documentation and we just suggested in Slack the way to accomplish our use case and has remained. In any case, changing to $userFood(userId:RrLJVnXTyIRLGTNlp6rZB89hqQ03 && addedToMeals:Breakfast)
stopped that errorHarpreet Sangar
08/29/2024, 7:34 AM"filter_by": "$userFood(addedToMeals:Breakfast)"
produces the error?Shaun Byrnes
08/29/2024, 7:36 AMShaun Byrnes
08/29/2024, 7:37 AM{
"q": "pizza",
"query_by": "name",
"filter_by": "$userFood(userId:OFSDzvSFkNOQ2Y0psX50b9ngdZG3 && addedToMeals:Breakfast)",
"include_fields": "$foodBrands(name) as foodBrand, $portionSizes(name) as portionSize, $userFood(count, dateLastUsed, addedToMeals)",
"sort_by": "$userFood(dateLastUsed:desc)"
}
is goodShaun Byrnes
08/29/2024, 7:37 AM{
"q": "pizza",
"query_by": "name",
"filter_by": "$userFood(userId:OFSDzvSFkNOQ2Y0psX50b9ngdZG3) && $userFood(addedToMeals:Breakfast)",
"include_fields": "$foodBrands(name) as foodBrand, $portionSizes(name) as portionSize, $userFood(count, dateLastUsed, addedToMeals)",
"sort_by": "$userFood(dateLastUsed:desc)"
}
Shaun Byrnes
08/29/2024, 7:37 AMRequestMalformed: Request failed with HTTP code 400 | Server said: Multiple references found to sort by on `userFood.dateLastUsed`.
Harpreet Sangar
08/29/2024, 7:45 AM$joinCollection(condition)
format.Shaun Byrnes
08/29/2024, 8:24 AMShaun Byrnes
08/29/2024, 8:24 AMShaun Byrnes
08/30/2024, 7:10 AMKishore Nallan
08/30/2024, 7:14 AMShaun Byrnes
08/30/2024, 7:14 AMShaun Byrnes
08/30/2024, 7:15 AMShaun Byrnes
08/30/2024, 7:15 AM