dataStore.Cursor
The content in this help topic pertains to SuiteScript 2.1.
|
Object Description |
An asynchronous iterator for accessing documents retrieved by Collection.find(query). Use Internally, results are retrieved in groups of up to 100 documents, with a combined document-body size of up to 10 MB per group. When you request a result beyond the current group, the cursor retrieves the next group as needed. An iteration that requires another retrieval, especially when handling larger documents, may take longer to complete. For information about retrieving the next result, see Cursor.next(). To end iteration explicitly, see Cursor.return(). |
|
Supported Script Types |
Server scripts |
|
Module |
|
|
Methods and Properties |
|
|
Since |
2026.2 |
Cursor Object Members
|
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
|---|---|---|---|---|
|
Method |
Server scripts |
Returns the next iterator result. |
||
|
Method |
Server scripts |
Closes the cursor and ends iteration. |
Syntax
The following code sample shows the syntax for this member. It isn't a functional example. For a complete script example, see N/dataStore Module Script Samples.
// Add additional code
...
const collection = dataStore.getCollection('checkpoints');
const cursor = await collection.find({ status: 'pending' });
for await (const result of cursor) {
const document = result.document;
const documentId = document._id;
}
...
// Add additional code