For background, I am using MongoDB and Rob Conery's linq driver. The code I am attempting is thus:
using (var session = new Session<ContentItem>())
{
var contentCollection = session.QueryCollection.Where(x => x.CreatedOn < DateTime.Now).OrderByDescending(y => y.CreatedOn).ToList();
ViewData.Model = contentCollection;
}
this will work on one machine, but on another machine I get back no results. To get results i have to do
using (var session = new Session<ContentItem>())
{
var contentCollection = session.QueryCollection.Where(x => x.CreatedOn < DateTime.Now).ToList();
ViewData.Model = contentCollection.OrderByDescending(y => y.CreatedOn).ToList();
}
I have to do ToList() on both lines, or no results. If I try to chain anything it breaks. This is the same project, all dll's are locally loaded. Both machines have the same framework, versions of Visual studio and addons. the only difference is one has VisualSVN the other AnkhSVN. I can't see those causing the problem.
Also, while debugging, on the machine that does not work you can see the items in the collection, and if you remove ordering all together it will work. This has got me completely stumped.