ReQL command: close
Command syntax
cursor.close([callback]) cursor.close() → promise
Description
Close a cursor. Closing a cursor cancels the corresponding query and frees the memory associated with the open request.
The close
command can optionally take a callback, which will receive an error if one occurs, or return a promise which will be resolved when the connection is closed.
Example: Close a cursor.
cursor.close(function (err) {
if (err) {
console.log("An error occurred on cursor close");
}
});
Example: Close a cursor and execute a function upon close.
cursor.close()
.then(function () {
console.log("The cursor has been closed");
})
.catch(r.Error.ReqlDriverError, function (err) {
console.log("An error occurred on cursor close");
});
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/javascript/close-cursor/