summaryrefslogtreecommitdiff
path: root/ext/librethinkdbxx/test/upstream/changefeeds/geo.rb.yaml
blob: 7755ff968e784435d08284fe289784932526dc11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
desc: Geo indexed changefeed operations
table_variable_name: tbl
tests:
    - rb: tbl.index_create('L', {geo: true})
      ot: partial({'created': 1})

    - rb: tbl.index_wait().count
      ot: 1

    - def: obj11 = {id: "11", L: r.point(1,1)}
    - def: obj12 = {id: "12", L: r.point(1,2)}
    - def: obj21 = {id: "21", L: r.point(2,1)}
    - def: obj22 = {id: "22", L: r.point(2,2)}

    # A distance of 130,000 meters from 1,1 is enough to cover 1,2 and 2,1 (~110km
    # distance) but not 2,2 (~150km distance.)
    #
    # This is useful because the S2LatLngRect bounding box passed to the shards contains
    # 2,2 yet it should not be returned in the changefeed results.
    - rb: feed = tbl.get_intersecting(r.circle(r.point(1,1), 130000), {index: "L"}).get_field("id").changes(include_initial: true)

    - rb: tbl.insert([obj11, obj12, obj21, obj22])
      ot: partial({'errors': 0, 'inserted': 4})

    - rb: fetch(feed, 3)
      ot: bag([{"new_val" => "11", "old_val" => nil}, {"new_val" => "12", "old_val" => nil}, {"new_val" => "21", "old_val" => nil}])