!CHAPTER Sequential Access and Cursors If a query returns a cursor, then you can use *hasNext* and *next* to iterate over the result set or *toArray* to convert it to an array. If the number of query results is expected to be big, it is possible to limit the amount of documents transferred between the server and the client to a specific value. This value is called *batchSize*. The *batchSize* can optionally be set before or when a simple query is executed. If the server has more documents than should be returned in a single batch, the server will set the *hasMore* attribute in the result. It will also return the id of the server-side cursor in the *id* attribute in the result. This id can be used with the cursor API to fetch any outstanding results from the server and dispose the server-side cursor afterwards. The initial *batchSize* value can be set using the *setBatchSize* method that is available for each type of simple query, or when the simple query is executed using its *execute* method. If no *batchSize* value is specified, the server will pick a reasonable default value. !SUBSECTION Has Next @startDocuBlock cursorHasNext !SUBSECTION Next @startDocuBlock cursorNext !SUBSECTION Set Batch size @startDocuBlock cursorSetBatchSize !SUBSECTION Get Batch size @startDocuBlock cursorGetBatchSize !SUBSECTION Execute Query @startDocuBlock queryExecute !SUBSECTION Dispose @startDocuBlock cursorDispose !SUBSECTION Count @startDocuBlock cursorCount