Quantcast
Channel: Using geospatial commands in rethinkdb with changefeed - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Jorge Silva for Using geospatial commands in rethinkdb with changefeed

$
0
0

You can't use .getIntersecting with .changes, but you can write essentially the same query by adding a filter after .changes that checks if the loc is within the circle. While .changes limits what you can write before the .changes, you write basically any query after the .changes and it will work.

r.table('Message')
  .changes()
  .filter(
    r.circle([-117.220406,32.719464], 10, {unit: 'mi'})
     .intersects(r.row('new_val')('loc'))
  )

Basically, every time there is a change in the table the update will get push to the changefeed, but it will get filtered out. Since there is not a lot of support for geospatial and changfeeds, this is more or less how you would need to integrate the two.

In the future, changefeeds will be much broader and you'll be able to write basically any query with .changes at the end.


Viewing all articles
Browse latest Browse all 2

Trending Articles