When will rethinkdb return a cursor -
i notice r.table('xxx') not return cursor return docs directly
is
cursorclient side implementation or there special thingsserverdid perform queries associatecursor?if has somethings related
server, , when receivecursor
for example specify result offset , size
skip,limitin query. server returncursoror resultdocs?
a driver returns cursor when query returns stream.
basically when server produces stream (a sequence lazily computed), driver return cursor. fetch rows cursor, server compute more elements in sequence.
for example, when run r.table('xxx'), cursor. server load documents disk request them driver.
in javascript driver, when query return array, driver sneak object mimics cursor interface between arrray , array.prototype. if query.run(...) returns sequence, can do
query.run(connection).then(function(result) { return result.toarray() }).then(function(result) { // result }).error(function(err) { // handle err }) basically if don't want think if getting cursor or array, can consider it's cursor.
you can read more stream/cursor here:
http://www.rethinkdb.com/docs/data-types/
Comments
Post a Comment