Home > Software engineering >  cosmos db LINQ query in documentation
cosmos db LINQ query in documentation

Time:12-15

I am reading the cosmos db documentation here https://3c5.com/DQRpv

There are several examples which say something like this

input.Select(family => family.parents[0].familyName);

where the input is IQueryable of object.

My question is how do I get an IQueryable of object but ?

CodePudding user response:

You can try something like below:

Container container = await this.database.CreateContainerIfNotExistsAsync(containerId, "<partitionkeypath>");
var input = this.container.GetItemLinqQueryable<Family>();
input.Select(family => family.parents[0].familyName);

Where Family is the class defined to map with container properties.

  • Related