0
I’d like to serve Getall already brought the list of posts in order according to the list of Ids passed by the parameter module. Higlights
List<Post> posts = new List<Post>();
var posts = PostService.GetAll(module.Highlights).ToList();
var postsAux = posts;
posts.Clear();
foreach (var item in module.Highlights){    
  var post = postAux.FirstOrDefault(p => p.Id == item);
  if(post != null)
     posts.Add(post);    
}
The system uses the Imongocollection:
public IEnumerable<Post> GetAll<Post>(IEnumerable<string> ids)
{
  if (ids == null)
    return new List<Post>();
  var collection = Db.GetCollection<Post>(typeof(Post).Name);
  var filter = Builders<Post>.Filter.In("Id", ids);
  return collection.Find(filter).ToList();
}
I have tried the following code unsuccessfully:
var query = from i in ids 
        join o in collection..AsQueryable()
        on i equals o.Id
        select o;