Defining a Read-Only Collection Query
Define a Collection Query GET handler that returns action items with nested team data.
Define the ORDS template handler for the GET method on the /actionitems template using the Source Type of Collection Query. This handler type uses a SQL query to specify the data to return. Having already created the ACTION_ITEMS_WITH_TEAM_JV view, the SQL is very simple as shown below. Just select the top-level attributes you want to include in the result. Notice two column aliases in use. They affect the JSON response:
-
"_id"– ensures the ID attribute has the JSON property name_id -
"{}team"– Uses{}to indicate theteamproperty is already in JSON format
select id as **"_id"**,
name,
status,
team as **"{}team"**
from action_items_with_team_jv
order by name, id
Once defined, your collection query handler for the v0 module’s /actionitems template is ready to test out. Click the Copy to Clipboard button as shown below to paste its URL into your favorite testing tool.

Description of the illustration ords-v0-collection-query.png