I think innerJoin
is sugar syntax on top of concat_map
. Actually, you can always use concatMap
to solve join problem.
Unfortunately you cannot use changes
after concatMap
, according to https://rethinkdb.com/docs/changefeeds/ruby/
We have an issue to track this, and it is probably landed in 2.3 or 2.4 as they said. https://github.com/rethinkdb/rethinkdb/issues/3997
So yes, you cannot use changes
after join
at this moment.
However, I'm trying to go a bit further to see if I can produce something that may work. Just give it a try.
From what I understand, you have a presence
table, your join is actually used as a filter/where author. highlights
contains presence.name
, then listen for change on it. How about trying to get the change first, then call filter
later to filter out data. Like this:
r.table("presence")
.changes()
.map(function(change) {
return change('new_val')
})
.filter(function(change) {
return r.table('authors').filter(function(author) {
return author('highlights').contains(change('name'))
}).count().gt(0)
})
Note that this query is not optimized. If it works for you, we can continue on adding index to make it run faster.