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
This would most likely need to be a new extension method where the given item has an object type, as the partial match would need to take an anonumous object so we can only supply the properties we need. If it uses the generic Linq .Contains<T>(...) extension methods it would require creating instances of that class, which would then serialise with null property values.
As if this was ArrayContains<T>(this IEnumerable<T> obj, T itemToMatch, bool partialMatch) then we'd need to always pass the same T type to this method. The downside is you loose some type checking (the anonymous object could have a property name typed wrong),
Describe alternatives you've considered
We can create a user defined function in cosmos that wraps the Array_Contains call, but we ran into issues with it not using indexes in searches.
Additional context
I had a quick play around to see if I could add this to the client lib, if this is a valid request I can create a PR for this new extension method
Is your feature request related to a problem? Please describe.
The
Array_Contains
function CosmosDB Sql has a 3rd parameter which allows it to do a partial match on the given item.https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/array-contains
The current Linq
array.Contains(item)
don't have a way to set this 3rd parameter to do the partial match.Describe the solution you'd like
A Linq extension method that allows me to set all the CosmosSql Array_Contains function parameters, something like this:
This would most likely need to be a new extension method where the given item has an
object
type, as the partial match would need to take an anonumous object so we can only supply the properties we need. If it uses the generic Linq.Contains<T>(...)
extension methods it would require creating instances of that class, which would then serialise with null property values.I.e. it would need to look like this
As if this was
ArrayContains<T>(this IEnumerable<T> obj, T itemToMatch, bool partialMatch)
then we'd need to always pass the sameT
type to this method. The downside is you loose some type checking (the anonymous object could have a property name typed wrong),Describe alternatives you've considered
We can create a user defined function in cosmos that wraps the
Array_Contains
call, but we ran into issues with it not using indexes in searches.Additional context
I had a quick play around to see if I could add this to the client lib, if this is a valid request I can create a PR for this new extension method
https://github.com/bcrobinson/azure-cosmos-dotnet-v3/tree/feature/array_contains_builtin_function
The text was updated successfully, but these errors were encountered: