本文介绍了C#MongoDB驱动程序仅返回100个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在写邮件标签,并且需要为每个文档打印标签.
I am writing a mailing label, and need to print a label for each document.
我的收藏集中有829个文档,但是当我检索它们时,我只会得到100个文档.
I have 829 documents on the Collection, but when I retrieve them, I only get 100 documents.
我有这个LINQ代码:
I have this LINQ code:
IMongoCollection Pessoa;
Pessoa = database.GetCollection<Pessoa>(collectionName);
return Pessoa.AsQueryable().ToList();
如何检索所有文档?
推荐答案
默认的光标BatchSize .您可以修改此行为,将AggregateOptions
对象传递给AsQueryable
扩展并将BatchSize
属性设置为足够大的值.
You're probably being limited by the default cursor BatchSize.You can modify this behaviour passing an AggregateOptions
object to the AsQueryable
extension and setting the BatchSize
property to a large enough value.
public static IMongoQueryable<TDocument> AsQueryable<TDocument>(this IMongoCollection<TDocument> collection, AggregateOptions aggregateOptions = null)
这篇关于C#MongoDB驱动程序仅返回100个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!