cursor.objsLeftInBatch()

  • cursor.objsLeftInBatch()

mongo Shell Method

This page documents the mongo shell method, and doesnot refer to the MongoDB Node.js driver (or any other driver)method. For corresponding MongoDB driver API, refer to your specificMongoDB driver documentation instead.

cursor.objsLeftInBatch() returns the number ofdocuments remaining in the current batch.

The MongoDB instance returns response in batches. To retrieveall the documents from a cursor may require multiple batchresponses from the MongoDB instance. When there are no moredocuments remaining in the current batch, the cursor will retrieveanother batch to get more documents until the cursor exhausts.