Query for $type field in Cosmos DB

I have a model persisted in Cosmos DB where I have some types that inherits from others types. Something like:

class ParentType {
    public string name;
}

class ChieldTypeOne : ParentType {
    public string propertyA;
}

class ChieldTypeTwo : ParentType {
    public string propertyB;
}

class ThirdType {
    public List<ParentType> Parents;
}

When I tried to query for all ThirdType documents where Parent.propertyB = 'somevalue', with Linq, I discovered that I can't use TypeOf<> with Cosmos DB .NET Client. I've try use SQL, but I don't know how to query for fields started with $ in the name to query for $type fields, that is created by Json.NET to differentiate for types of documents.

Some one has experienced this situation and found a solution?

Thks,

Luiz

0 Comment

NO COMMENTS

LEAVE A REPLY

Captcha image