diff --git a/website/docs/api/soql.md b/website/docs/api/soql.md index f3fd609e..b0cc4a81 100644 --- a/website/docs/api/soql.md +++ b/website/docs/api/soql.md @@ -1524,7 +1524,7 @@ Map> toAggregatedMap(SObjectField keyField) **Example** ```apex -Map industryToAccounts = SOQL.of(Account.SObjectType).toAggregatedMap(Account.Industry); +Map> industryToAccounts = (Map>) SOQL.of(Account.SObjectType).toAggregatedMap(Account.Industry); ``` ### toAggregatedMap with custom value diff --git a/website/docs/examples/result.md b/website/docs/examples/result.md index 86cbe0b1..b3dbdc9c 100644 --- a/website/docs/examples/result.md +++ b/website/docs/examples/result.md @@ -44,8 +44,24 @@ public with sharing class MyController { return SOQL_Account.query().count().toInteger(); } - public static Map getAccountMap() { - return SOQL_Account.query().toMap(); + public static Map getAccountMap() { + return (Map) SOQL_Account.query().toMap(); + } + + public static Map getAccountsPerName() { + return (Map) SOQL_Account.query().toMap(Account.Name); + } + + public static Map getAccountIndustryPerAccountId() { + return SOQL_Account.query().toMap(Account.Id, Account.Industry); + } + + public static Map> getAccountsPerIndustry() { + return (Map>) SOQL_Account.query().toAggregatedMap(Account.Industry); + } + + public static Map> getAccountNamesPerIndustry() { + return SOQL_Account.query().toAggregatedMap(Account.Industry, Account.Name); } public static Database.QueryLocator getAccountQueryLocator() {