Skip to content
This page View Markdown Open in ChatGPT Open in Claude

select

select keeps only the fields you name, or, with -, everything but the fields you name. Less data on the wire, and nothing a screen does not need.

Only these fields
GET /api/schema/admin/mysql8/inventory/customers?select=first_name,last_name
Answer : the primary key always comes along
{
    "success": true,
    "statusCode": 200,
    "data": [
        { "customer_id": 1, "first_name": "Bob", "last_name": "Lin" },
        { "customer_id": 2, "first_name": "Alice", "last_name": "Page" }
    ]
}
Everything but these fields
GET /api/schema/admin/mysql8/inventory/customers?select=-last_update,-isActive
Body of the query APIs : a string or an object
{ "find": {}, "select": "first_name,last_name" }
{ "find": {}, "select": { "first_name": 1, "last_name": 1 } }
  • On MongoDB a nested field selects too : select=address.city.
  • Do not mix included and excluded fields in one select.
  • The write APIs (save, master save, update by id, replace by id, remove by id) accept select to shape the row they answer with.
  • Inside a deep item, select picks the fields of the related rows : deep=[{s_key:'customer_id',t_col:'orders',t_key:'customer_id',select:'order_no,total'}].
  • A field the group of the caller can not read never comes back, selected or not : that is the field permission of API group permission.