I’m building dynamic search/sort mechanism. I get my data as an IMongoQueryable<T>
. I then build filters using Builders<T>.Filter
and apply them using Inject. E.g.
var filter = Builders<T>.Filter.Eq("Fieldname", "value");
items = items.Where(x => filter.Inject());
where items is an IMongoQueryable<T>
.
Now if I do the same for sort, e.g.
var sort = Builders<T>.Sort.Descending("someProperty);
How do I apply the sort to my IMongoQueryable<T>
? I found examples on how to use it when you have IMongoCollection<T>
to work with, but this is not an option for me.