aboutsummaryrefslogtreecommitdiff

Count

back to query /// home

Count rows matching a filter. Like select but just gives you the number in data field.

Request

{
  "action": "count",
  "table": "items",
  "filter": {
    "column": "status",
    "op": "=",
    "value": "active"
  }
}

Fields

Field Type Required Notes
action string yes must be "count"
table string yes target table
where object no simple key value filter
filter object no structured filter
joins array no join other tables if needed

No limit or offset for count, it always counts everything that matches.

Response

{
  "success": true,
  "data": 42
}

data is just the count as a number.

Behaviors

  • should support joins so you can count rows with conditions on related tables
  • ownership scoping should apply: if you have rwo or rwg the count should only include rows you have access to
  • you need at least read permission on the table