Skip to content

Cosmos: Add support for IS_DEFINED() to EF.Functions  #17722

@divega

Description

@divega

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:

var itemsMissingData = context.Items.Where(i => !EF.Functions.IsDefined(i.Data));

Metadata

Metadata

Assignees

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions