Closed mattcahill01 closed 8 years ago
You can't. MongoRepository is a (deliberately) simple repository abstraction on top of the mongo-csharp-driver. If you want to use mongo-specific or advanced features you're probably better of using the driver directly.
Hello! I have been using MongoRepository for my project and I am keen to understand how best I incorporate the $lookup and $match aggregation features of Mongo 3.2?
I am trying to do this:
private readonly IRepository<UserItem> _userItemRepository; var pipeline = _userItemRepository.Aggregate() .Match(x => x.UserId == userId && x.PublisherId == publisherId);
but unfortunately it does not work (Intellisense errors all over the place) unless I bypass the MongoRepository and go to the MongoClient direct as so:
var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("MyDb"); var users = database.GetCollection<UserItem>("users"); var pipeline = users.Aggregate() .Match(x => x.UserId == userId && x.PublisherId == publisherId);
Looking for your advice on how best to approach this?