Basic, but clear example with everything you need to get this working:
RavenDB is a document database, and unlike a relational database (like say Microsoft SQL Server) – you can’t do your usual group-by type queries quite as simply. […] For RavenDB instead I need to use a Map-Reduce query. The basics of this are that the first part (the Map) runs over the documents, and finds the matches. The reduce then takes the found matches, and summarises (reduces) the result set.
Original title and link: RavenDB: Emulating Group By Using MapReduce (NoSQL databases © myNoSQL)