- type: fetch
  model: accounts
  query:
    _fields:
      account_id: 1
      version: 1
  destination: account
  as_entity: true

- type: fetch
  model: accounts
  source: events
  destination: events
  map:
    - from: account.account_id
      to: account_id

- type: op
  path: events
  func: length
  destination: events_count

- type: op
  func: max
  path: events
  destination: events_max
  args:
    - path: version
      default: 0
  args_as_array: true
