cursor.each { ... }
array.each { ... }
feed.each { ... }
Lazily iterate over a result set one element at a time.
RethinkDB sequences can be iterated through via the Ruby Enumerable interface; use standard Ruby commands like each
blocks to access each item in the sequence.
Example: Let’s process all the elements!
cursor = r.table('users').run(conn)
cursor.each { |doc|
process_row(doc)
}
Example: Stop the iteration prematurely and close the connection manually.
cursor = r.table('users').run(conn)
cursor.each do |doc|
ok = process_row(doc)
if not ok
cursor.close()
break
end
end
Couldn't find what you were looking for?
Contribute: edit this page or open an issue