We will modify the CountryPopulation
index and will define its Map
, Reduce
, and TransformResults
functions. This new index version will aggregate the Population
for each Country
and will transform the query result to a new format the shape of which is the same as the CountryPopulation
class which you will also create. Then you will open the index in Management Studio to execute it and view its result.
Open the
RavenDB_Ch04
project in Visual Studio.Add a new class to the
RavenDB_Ch04
project, name itCountryPopulation
and make it look like the following code snippet:Add the new
CountryPopulation
index definition to theMain()
method using the following code:Add the following code to the
Main()
method to query theCities/CountryPopulation
index.Save all the files, build and run the solution.
In Management Studio, execute the
Cities/CountryPopulation
index and observe the result when the Skip Transform option is checked and when it is not...