As we have seen in previous blog posts getting data from a RavenDB database is easy. Either use the IDocumentSession.Query<T>() function to load a series of documents or the IDocumentSession..Load<T>() function to load a document using its identity. However sometimes we want more control over what we want to load. It turns out this is rather easy as the IDocumentSession.Query<T>() function returns an IQueryable<T>, actually it returns a IRavenQueryable<T> to be exact but more about that another time. Querying the database As IDocumentSession.Query<T>() return an IQueryable<T> we can just start composing queries just as we can with EntityFramework or another ORM. In my original online example you might have noticed that the books aren't ordered. As with any query this is easy to correct. All we need to do is add an order by clause. 1:public ActionResult Index() 2: { 3:using (var session = MvcApplication.DocumentStore.OpenSession()) 4: { 5: var books = session.Query<Book>() 6: .OrderBy(b => b.Title) 7: .ToList(); 8: 9:return...