Horizo​​n 客户端库:group-by 可行吗?

Horizon client library: is group-by doable?

我正在使用 horizo​​n 后端和 reactjs 前端实现简单的 webapp。我需要获取按特定字段分组的集合 (table)。然后我需要通过另一个字段对每个归约进行排序,并将每次归约中的记录限制为 1。Reql 查询 returns 我需要什么:

r.db('reporter').table('reports')
  .group('project_name')
  .orderBy(r.desc('time_created'))
  .limit(1)

我没有在文档中找到相关方法(组)(http://horizon.io/api/collection/)。我知道我可能误解了 Collection 对象的作用——根据我目前的理解,它是 rethinkdb table 的直接代理,并且 table 上可用的所有操作都应该在集合上可用——我错了吗?是否需要实施中间层才能获得此行为?

Horizo​​n API 比 RethinkDB API 更受限制。集合上定义的唯一方法是 http://horizon.io/api/collection/ . If you need more complicated behavior, you can embed Horizon in a NodeJS app and define a custom endpoint that issues any ReQL query you want: http://horizon.io/docs/embed/ 中列出的方法。

您可以在 front-end 上使用 rxjs groupBy 执行此操作,因为 horizon.io returns rxjs observables。

https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/groupby.md