DQL Roadmap Functionality
🚧 the functionality in this article is in active development and not supported in this version of the dql language this document outlines functionality in the dql language that is in active development this is not an exhaustive list of the features and functionality the ditto team is tracking concerning dql and aims to address larger functionality gaps all syntax included in this article is sudo syntax added to express functionality the final syntax may differ from the syntax included here 🚧 projections a projection refers to an operation of selecting specific fields from a collection in a query result by allowing you to specify which fields you want to include in the output of a query while excluding others dql select field1, field2 from your collection name 🚧 aggregates applied most commonly to grouped data or the entire result set of a query, use aggregation functions to perform calculations on a set of values and produce a single result, as well as summarize data across multiple documents in a collection aggregate operations count sum max min avg dql select count(field1), sum(field2), max(field3), min(field4), avg(field5) from your collection name 🚧 group by the group by clause is used to group documents based on one or more fields in a query it allows you to group data together based on common values in specific fields and perform aggregate calculations on those groups dql select category, count( ) from your collection name group by category; 🚧 having the having clause is used in conjunction with the group by clause to filter the result of a query based on conditions involving aggregate functions the having clause allows you to apply filtering conditions to the grouped data in a query dql select field1, aggregate function(field2) from your collection name group by field1 having condition; 🚧 aliasing aliasing allows users to assign a temporary name or alias to a collection or field in a query aliases are assigned using the as keyword followed by the alias aliasing a collection dql select c field1 from your collection name as c aliasing a field dql select field1 as f from your collection name 🚧 multiple from terms multiple from terms can be used to refer to multiple collections within a query when you include multiple from terms, the result is a cross product of the collections this results in a larger result set that includes all possible combinations dql select from collection1, collection2 🚧 joins joins are used to combine documents from two or more tables based on a related fields between them join types include left join inner join cross join right join outer join dql select cars id, dealerships id, dealerships location from cars inner join dealerships on cars dealership id = dealerships id 🚧 insert with cbor the insert into statement will support cbor serialized data cbor data is declared using cbor keyword prior to the cbor object import { encode, decode } from "cbor"; const data = { id "123", field1 0, field2 "blue" }; const cbordata = encode(data); ditto store execute(` 	insert into your collection name 	documents (cbor \ cbordata)`, 	{ cbordata }); 🚧 secondary indexing an index is a data structure that enhances the efficiency of queries by providing a faster lookup mechanism for retrieving data based on specific attributes or fields an index allows dql to locate and access data more quickly, reducing the need for scanning the entire collection or table dql create index index name on your collection name (field1, field2, ); dql drop index index name dql select from your collection name use index (index name) where field1 > 10000 🚧 pre defined type definitions setting a pre defined type definition will allow users to set a type definition once for a given collection instead of needing to declare it within each query dql define collection your collection name ( field1 register, field2 map, filed3 attachment, ) 🚧 cross collection transactions cross collection atomic modifications allows for multiple modifications to occur across transactions begin transaction; \ update an employee's name update employees set name = 'new name' where id = '123'; \ update a department's budget update departments set budget = 50000 where id = 'department 456'; commit;