You will create the Cities_RelatedCountry
index which will implement the LoadDocuement()
method. Then you will query this index while running the RavenDB_Ch06
project using the Management Studio.
Open the
RavenDB_Ch06
project in Visual Studio.Add a new class and name it
Cities_RelatedCountry
.Complete the
Cities_RelatedCountry
class definition using the following code snippet:Add the index's
Map
function within the class constructor using the following code snippet:Add the following code snippet to the
Main()
method:Save all the files, build and run the solution.
You just learned how to index related documents in RavenDB. In order to implement this feature, you called the LoadDocument()
method within the Cities_RelatedCountry
index's Map
function.
The index's Map
function defines three fields: Name
, Population
which will hold values from the City
document, and CountryName
which will hold information from the Country
document....