收听 RethinkDB 中复杂查询的更改提要
Listen change feed of complex queries in RethinkDB
当我有这样的查询时:
r.db('universe')
.table('Star')
.getAll(
r.db('universe').table('Ship').get(idShip)('idCurrentGalaxy'),
{index: 'idGalaxy'}
)
.changes({includeInitial: true})
我希望它会在
时更新 changefeed
- 选定的星星得到更新
- 所选ship.idCurrentGalaxy改变
对于此查询,只有 1. 为真。如果可能的话,我如何更改此查询以使 2. 也为真?
The data behind the query could be something like this:
//stars
{id: 1, idGalaxy: 1, name: 'Aldhafera'}
{id: 2, idGalaxy: 1, name: 'Duhr'}
{id: 3, idGalaxy: 2, name: 'Menchib'}
//galaxies
{id: 1, name: 'Milky Way'}
{id: 2, name: 'Andromeda'}
//ships
{id: 1, idCurrentGalaxy: 1}
and the query above would result this:
{id: 1, idGalaxy: 1, name: 'Aldhafera'}
{id: 2, idGalaxy: 1, name: 'Duhr'}
目前没有办法在 RethinkDB 中获得它;您必须打开两个更改源并自己将它们拼接在一起。最终将添加对此的支持;您可以在 https://github.com/rethinkdb/rethinkdb/issues/3997 跟踪进度。
当我有这样的查询时:
r.db('universe')
.table('Star')
.getAll(
r.db('universe').table('Ship').get(idShip)('idCurrentGalaxy'),
{index: 'idGalaxy'}
)
.changes({includeInitial: true})
我希望它会在
时更新 changefeed- 选定的星星得到更新
- 所选ship.idCurrentGalaxy改变
对于此查询,只有 1. 为真。如果可能的话,我如何更改此查询以使 2. 也为真?
The data behind the query could be something like this:
//stars
{id: 1, idGalaxy: 1, name: 'Aldhafera'}
{id: 2, idGalaxy: 1, name: 'Duhr'}
{id: 3, idGalaxy: 2, name: 'Menchib'}
//galaxies
{id: 1, name: 'Milky Way'}
{id: 2, name: 'Andromeda'}
//ships
{id: 1, idCurrentGalaxy: 1}
and the query above would result this:
{id: 1, idGalaxy: 1, name: 'Aldhafera'}
{id: 2, idGalaxy: 1, name: 'Duhr'}
目前没有办法在 RethinkDB 中获得它;您必须打开两个更改源并自己将它们拼接在一起。最终将添加对此的支持;您可以在 https://github.com/rethinkdb/rethinkdb/issues/3997 跟踪进度。