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()
Added 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
error
If
close()
succeeds,error
is NULL. If an error occurs, thenerror
contains the error message.
- sodaDocumentCursor.getNext()
Added 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
document
parameter 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
error
If
getNext()
succeeds,error
is NULL. If an error occurs, thenerror
contains the error message.SodaDocument
document
The next document in the cursor. If there are no more documents, then
document
will be undefined.