Queries
Overview
Midio expressions support a specialized query expression syntax for working with lists of data in a clear, readable, and declarative way.
A query expression is composed of a sequence of clauses that are evaluated top to bottom:
fromintroduces a variable that iterates over a collectionwherefilters elements based on a condition (optional)joincombines elements from multiple collections based on a predicate (optional)selectdefines the final shape of the result
At minimum, a query must contain a from clause and a select clause. Additional clauses refine or enrich the data as needed.
Basic Queries (from / select)
Example 1: Transforming values
Convert each number in a list into a new value.
from n in [1, 2, 3, 4]
select n * 2Example 2: Selecting a field from objects
Extract a single field from each object.
Example 3: Constructing new objects
Build a new object for each element in the collection.
Filtering with where
Example 4: Filtering values
Keep only values that satisfy a condition.
Example 5: Filtering objects
Filter objects before selecting a field.
Example 6: Filtering and transforming
Filter objects and return a transformed result.
Joining Collections (join)
Example 7: Simple join
Description: Combine related data from two collections.
Example 8: Join with filtering
Join data and filter the combined result.
Example 9: Join with conditions on both sides
Use fields from both collections in the filter.
Last updated