13. API: SodaDocumentCursor Class
A SodaDocumentCursor is used to walk through a set of SODA documents
returned from sodaCollection.find() and
sodaOperation.getCursor() methods.
Note
In this release, SODA is only supported in the node-oracledb Thick mode. See Enabling node-oracledb Thick Mode.
From node-oracledb 6.4, the SodaDocumentCursor class implements the
asyncIterator() symbol to support asynchronous iteration. See
Creating and Accessing SODA Documents for examples.
13.1. SodaDocumentCursor Methods
- sodaDocumentCursor.close()
New in version 3.0.
Promise:
promise = close();
Closes a SodaDocumentCursor. It must be called when the cursor is no longer required. It releases resources in node-oracledb and Oracle Database.
Callback:
If you are using the callback programming style:
close(function(Error error){});
The parameters of the callback function
function(Error error)are:Callback Function Parameter
Description
Error
errorIf
close()succeeds,erroris NULL. If an error occurs, thenerrorcontains the error message.
- sodaDocumentCursor.getNext()
New in version 3.0.
Promise:
promise = getNext();
Returns the next SodaDocument in the cursor returned by a
find()terminal method read operation.If there are no more documents, the returned
documentparameter will be undefined.Callback:
If you are using the callback programming style:
getNext(function(Error error, SodaDocument document){});
The parameters of the callback function
function(Error error, SodaDocument document)are:Callback Function Parameter
Description
Error
errorIf
getNext()succeeds,erroris NULL. If an error occurs, thenerrorcontains the error message.SodaDocument
documentThe next document in the cursor. If there are no more documents, then
documentwill be undefined.