发布于 2015-09-14 15:04:46 | 256 次阅读 | 评论: 0 | 来源: 网络整理

cursor.batchSize()

The batchSize() method specifies the number of documents to return in each batch of the response from the MongoDB instance. In most cases, modifying the batch size will not affect the user or the application since the mongo shell and most drivers return results as if MongoDB returned a single batch.

The batchSize() method takes the following parameter:

参数:
  • size – The number of documents to return per batch. Do not use a batch size of 1.

注解

Specifying 1 or a negative number is analogous to using the limit() method.

Consider the following example of the batchSize() method in the mongo shell:

db.inventory.find().batchSize(10)

This operation will set the batch size for the results of a query (i.e. find()) to 10. The effects of this operation do not affect the output in the mongo shell, which always iterates over the first 20 documents.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务