-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cosmos: Add support for IS_DEFINED() to EF.Functions #17722
Comments
It seems that Cosmos DB is still filtering out documents where a property is undefined if you ORDER BY that property. This makes providing access to the IS_DEFINED() function from LINQ queries more important. That way, you can use it like this: var orderedItems = context.Items.OrderBy(i => i.Data);
var itemsMissingData = context.Items.Where(i => !EF.Functions.IsDefined(i.Data));
orderedItems.AddRange(itemsMissingData); |
Also consider Coalesce operator ?? which is used to coalesce based on present keys. |
Do we have a timeline on when this will be implemented? |
@prachita-mane It's in the backlog meaning we don't plan on working on it in the upcoming releases. However we are open to well-written external PRs. |
Is there an alternative to this? For example I am trying to check if a nested property is null and am getting an exception about the query not being able to be translated. My query looks like the following where
This throws the following exception:
Are we dealing with the same/similar thing here? I would have expected the translation for CosmosDB to be as simple as
|
Note to implementer, add these test cases:
|
Note also #33904, which is about adding support for the undefined coalescing operator ( |
Poaching as I'm in the area with #33904. |
Continues dotnet#25765, dotnet#25701 Closes dotnet#17722 Closes dotnet#33904
Continues dotnet#25765, dotnet#25701 Closes dotnet#17722 Closes dotnet#33904
Continues dotnet#25765, dotnet#25701 Closes dotnet#17722 Closes dotnet#33904
The full context is explained in #13131, but I decided to create a new issue to gather more targeted customer feedback on this.
The short version is that in a schema-less database like Cosmos DB it is valid for each document in a container to contain completely different set of properties. In an object mapping situation this translates into some of the mapped properties being absent. Cosmos DB provides a function IS_DEFINED() that can be used in queries to test for this situation. Note also that a property not being defined is different (albeit one can argue only slightly) from the value being null.
The Cosmos DB provider could define an extension method in EF.Functions that could be used, for example, like this:
The text was updated successfully, but these errors were encountered: