I am currently teaching a course in RavenDB, and as usual during a course, we keep doing a lot of work that pushes what we do with RavenDB. Usually because we try to come up with new scenarios on the fly and adapting to the questions from the students.
In this case, we were going over the map/reduce stack and we kept coming more and more complex example and how to handle them, and then we got to this scenario.
Given the following class structure:
2.{
3.public string Name { get; set; }
4.public string Species { get; set; }
5.public string Breed { get; set; }
6.}Give me the count of all the species and all the breeds. That is pretty easy to do, right? In SQL, you would write it like this:
2.GROUP BY Species, Breed
In this case, we were going over the map/reduce stack and we kept coming more and more complex example and how to handle them, and then we got to this scenario.
Given the following class structure:
CODE:
1.1: public class Animal2.{
3.public string Name { get; set; }
4.public string Species { get; set; }
5.public string Breed { get; set; }
6.}Give me the count of all the species and all the breeds. That is pretty easy to do, right? In SQL, you would write it like this:
CODE:
1.SELECT Species, Breed, Count(*) FROM Animals2.GROUP BY Species, Breed
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-751075/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/301743/viewspace-751075/