Returns an iterator function and cursor itself so that the statement
for value in cursor:iterator() do ... endwill iterate over all values from the cursor.
This method is semantically equivalent to:
function cursor:iterator(handler)
return function (cursor)
return cursor:value(handler)
end,
cursor
endChecks if cursor allows for more documents to be acquired. Useful for tailable cursors.
Iterates cursor and returns the next BSON document from it or nil if there are no more
documents to read. On error, returns nil and the error message.
Iterates cursor and returns the next value from it or nil if there are no more documents to read.
On error, exception is thrown.
This method is semantically equivalent to:
function cursor:value(handler)
local bson, err = cursor:next()
if bson then
return bson:value(handler)
end
if err then
error(err)
end
return nil
endexcept that it avoids creating a temporary BSON document.