I know that i can subscribe for listen the changes on a table doing this
r.table('users').changes().run(conn, function(err, cursor) {
cursor.each(console.log);
});
But, how i can stop to listen this changes? How i can unsubscribe for this changes?
You can just call
cursor.close()
, (or you can doconn.close()
)From the docs for cursor.close:
Additionally, closing the connection itself will automatically close all cursors associated with a connection. In other words, if you're closing connections properly, you usually won't need to explicitly close your cursors.
From the connection.close docs: