首页 新闻 会员 周边

mongdob 排序后分页的问题

0
悬赏园豆:10 [已关闭问题] 关闭于 2016-03-12 15:36

一、环境

windows2012R2+mongdob 3.0X+ mongdb c#driver 2.2.1.6

二、数据分页显示

1.接口

public IQueryable<T> Table
{
    get
   {        return collection.AsQueryable<T>();

    }
}

 

2.查询

var query = _articleRepository.Table;


 query = query.OrderByDescending(b => b.CreatedOnUtc);

var result= query.ToList();

(简化了,实际是排序后分页获取数据)

3.数据量大时出现错误

出现如下错误:

An unhandled exception occurred while processing the request.

MongoCommandException: Command aggregate failed: exception: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting. Aborting operation. Pass allowDiskUse:true to opt in..

在 MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)

 

4.allowDiskUse:true 不知都在哪设置,求教。

freewzx2005的主页 freewzx2005 | 初学一级 | 园豆:8
提问于:2016-03-05 11:11
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册