How to use the rethinkdb-ts.r.do function in rethinkdb-ts

To help you get started, we’ve selected a few rethinkdb-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rethinkdb / rethinkdb-desktop / app / main / db / queries / stats.js View on Github external
const getServerStats = () => {
  const serverConfig = sysTable('server_config')
  const serverStatus = sysTable('server_status')
  const tableConfig = sysTable('table_config')

  return r
    .do(
      serverConfig.nth(0),
      // All connected servers
      serverStatus('name').coerceTo('array'),
      // All servers assigned to tables
      tableConfig
        .concatMap(row => row('shards').default([]))
        .concatMap(row => row('replicas'))
        .distinct(),
      (server, connectedServers, assignedServers) => ({
        server,
        serversConnected: connectedServers.count(),
        serversMissing: assignedServers.setDifference(connectedServers),
        unknownMissing: tableConfig
          .filter(row => row.hasFields('shards').not())('name')
          .isEmpty()

rethinkdb-ts

RethinkDB TypeScript driver

Apache-2.0
Latest version published 6 months ago

Package Health Score

70 / 100
Full package analysis

Similar packages