Calculating a cross-partition aggregate with an asynchronous query
The following lines declare the code for the DoesCompetitionWithTitleExist
asynchronous static method, which builds a query to count the number of competitions with the received title. In order to compute this aggregate, we must run a cross-partition query because the title for the competition can be at any location; that is, at any ZIP code. Cross-partition queries only support aggregates that use the VALUE
keyword as a prefix. We learned about this keyword in the previous chapter.
Â
Â
As happened in other samples, there are other ways of achieving the same results. In this case, we use a similar pattern to the one we introduced in the GetCompetitionByTitle
asynchronous static method. Add the following lines to the existing code of the Program.cs
file. The code file for the sample is included in the learning_cosmos_db_05_01
folder in the dot_net_core_2_samples/SampleApp1/SampleApp1/Program.cs
file:
private static async Task...