stream.union(sequence[, sequence, ...][, interleave=True]) → stream array.union(sequence[, sequence, ...][, interleave=True]) → array r.union(stream, sequence[, sequence, ...][, interleave=True]) → stream r.union(array, sequence[, sequence, ...][, interleave=True]) → array
Merge two or more sequences.
interleave argument controls how the sequences will be merged:
True: results will be mixed together; this is the fastest setting, but ordering of elements is not guaranteed. (This is the default.)
False: input sequences will be appended to one another, left to right.
"field_name": a string will be taken as the name of a field to perform a merge-sort on. The input sequences must be ordered before being passed to
interleaveargument can take a function whose argument is the current row, and whose return value is a string to take as a field name, as with the
"field_name"setting described above.
Example: Construct a stream of all heroes.
Example: Combine four arrays into one.
r.expr([1, 2]).union([3, 4], [5, 6], [7, 8, 9]).run(conn) [1, 2, 3, 4, 5, 6, 7, 8, 9]
Example: Create a changefeed from the first example.
Now, when any heroes are added, modified or deleted from either table, a change notification will be sent out.
Example: Merge-sort the tables of heroes, ordered by name.
r.table('marvel').order_by('name').union( r.table('dc').order_by('name'), interleave='name' ).run(conn)
Couldn't find what you were looking for?
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.