C#mongodb driver命令聚合失败排序超出内存限制104857600字节

时间:2015-09-03 16:34:09

标签: c# mongodb aggregation-framework

我尝试用c#mongodb驱动程序(MongoDB.Driver.2.0.1)执行查询,

dbCollection.Aggregate().Match(query).Sort(sort Definition).Skip(startIndex - 1).Limit(count).ToListAsync().Result

它出现错误:"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..."

当我添加一个allowDiskUse = true选项时,它会执行成功的

dbCollection.Aggregate(new Aggregated Options{AllowDiskUse=true}).Match(query).Sort(sort Definition).Skip(startIndex - 1).Limit(count).ToListAsync().Result

但是,我想了解,它的查询在服务器上执行?因为当我在robomongo(在服务器上)执行带有限制的查询时,它不会丢弃,但是当我完成此查询而没有限制时,它就会掉线。

0 个答案:

没有答案