Returns an iterator function and cursor
itself so that the statement
for value in cursor:iterator() do ... end
will 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
end
Checks 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
end
except that it avoids creating a temporary BSON document.