これらの方法は、Mongo Db Driver for C# を使用したクエリに対して、他の方法よりも最適化されていますか?:
var partsLogs = MvcApplication.MongoLoggingDatabase.GetCollection("PartDetailLog") .FindAll()
.Where(x => x.UserId == UserId) .Select(x => new RecentActivityPartsLogDto { OemCode = x.Request.OemCode, OemPartCode = x.Request.OemPartCode, OemPartDescription = x.Request.OemPartDescription, TimeStamp = x.TimeStamp, UserId = x.UserId.ToString() }) .OrderByDescending(x => x.TimeStamp) .Skip(pageSize * (page - 1)) .Take(pageSize);
または
var doc = new QueryDocument(); doc["UserId"] = UserId;
var partsLogs = MvcApplication.MongoLoggingDatabase.GetCollection("PartDetailLog")
.Find(doc) .Select(x => new RecentActivityPartsLogDto { OemCode = x.Request.OemCode, OemPartCode = x.Request.OemPartCode, OemPartDescription = x.Request.OemPartDescription, TimeStamp = x.TimeStamp, UserId = x.UserId.ToString()}) .OrderByDescending(x => x.TimeStamp) .Skip(pageSize*(page - 1)) .Take(pageSize);
このクエリを改善するための他の推奨事項はありますか?