close
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"); });
Related commands
Get more help
Couldn't find what you were looking for?
- Ask a question on Stack Overflow
- Chat with us and our community on Slack
- Talk to the team on IRC on #rethinkdb@freenode.net — via Webchat
- Ping @rethinkdb on Twitter
- Post an issue on the documentation issue tracker on GitHub
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/javascript/close-cursor/