You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cosmos: Translate subquery in filter condition #17957
However, this results in a query translation error:
System.InvalidOperationException: The LINQ expression 'Where(\r\n source: DbSet, \r\n predicate: (s) => Any(\r\n source: AsQueryable(Property<ICollection>(s, "AuthorizedUsers")), \r\n predicate: (o) => o.LoginName == "[email protected]"))' could not be translated. Either rewrite the query in a form that can be translated
Question: is this something that is or should be possible to achieve? The same query can be executed on CosmosDB SQL syntax, like this:
SELECT VALUE c
FROM c
WHERE EXISTS(
SELECT VALUE u
FROM u INc.AuthorizedUsersWHEREu.LoginName="[email protected]"
)
Reacted by Marco Labarile, Andy Macdonald, Brian Gardner, YohanS, cschulzsuper, Matthew Lieder, Cristian Ochisor, George Chondrompilas, Silvério Miranda, Aford73 and 14 more
@NickSevens - We don't have translation of subcollections composition in Cosmos yet. Mainly Exists operator or a in root.Orders pattern (which is used for join).
I can confirm that the query types listed on this issue should be fully working on EF 9.0 (this is a specific case of querying over nested collections, #16926, #25364). If memory serves, preview.7 - to be released in the next few days - should already work, so once that's released can you please test with it and report back on this issue?
I can confirm that the query types listed on this issue should be fully working on EF 9.0 (this is a specific case of querying over nested collections, #16926, #25364). If memory serves, preview.7 - to be released in the next few days - should already work, so once that's released can you please test with it and report back on this issue?
Hi Roji,
These are excellent news.
Yes, once EF9 is released, we will test this and report the outcome.
Thank you for your support.
Activity
smitpatel commentedon Sep 20, 2019
CosmosDb also supports Exists operator. I could not find it docs (hence it hasn't implemented yet) but query runs correctly.
nse7ens commentedon Sep 20, 2019
@smitpatel you mean there is an undocumented way to achieve the same result using EF als linq? Or what do you mean exactly?
smitpatel commentedon Sep 20, 2019
I meant that it is not in cosmos docs so we did not know that such SQL was valid. Hence it does not work in EF Core yet.
nse7ens commentedon Sep 20, 2019
smitpatel commentedon Sep 20, 2019
No work-around.
AndriySvyryd commentedon Sep 20, 2019
Related to #16146
nse7ens commentedon Sep 22, 2019
@AndriySvyryd @smitpatel are there any other operators that do translate into a subquery (JOIN, SELECT, ...)?
smitpatel commentedon Sep 23, 2019
@NickSevens - We don't have translation of subcollections composition in Cosmos yet. Mainly
Existsoperator ora in root.Orderspattern (which is used for join).[-]CosmosDB query nested data[/-][+]Cosmos: Query nested data[/+][-]Cosmos: Query nested data[/-][+]Cosmos: Translate subquery in filter condition[/+]31 remaining items
roji commentedon Aug 14, 2024
I can confirm that the query types listed on this issue should be fully working on EF 9.0 (this is a specific case of querying over nested collections, #16926, #25364). If memory serves, preview.7 - to be released in the next few days - should already work, so once that's released can you please test with it and report back on this issue?
hasmMarques commentedon Aug 14, 2024
Hi Roji,
These are excellent news.
Yes, once EF9 is released, we will test this and report the outcome.
Thank you for your support.
hasmMarques commentedon Jan 10, 2025
Hi,
I confirm that this issue is now fixed in EF9.
Thank you for your support!
roji commentedon Jan 10, 2025
@hasmMarques great, thanks for confirming!