Skip to content

Commit

Permalink
documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
pgajek2 committed Oct 10, 2023
1 parent bea65e6 commit 2bb5566
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion website/docs/api/soql.md
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ Map<String, List<SObject>> toAggregatedMap(SObjectField keyField)
**Example**

```apex
Map<String, Account> industryToAccounts = SOQL.of(Account.SObjectType).toAggregatedMap(Account.Industry);
Map<String, List<Account>> industryToAccounts = (Map<String, List<Account>>) SOQL.of(Account.SObjectType).toAggregatedMap(Account.Industry);
```

### toAggregatedMap with custom value
Expand Down
20 changes: 18 additions & 2 deletions website/docs/examples/result.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,24 @@ public with sharing class MyController {
return SOQL_Account.query().count().toInteger();
}
public static Map<Id, SObject> getAccountMap() {
return SOQL_Account.query().toMap();
public static Map<Id, Account> getAccountMap() {
return (Map<Id, Account>) SOQL_Account.query().toMap();
}
public static Map<String, Account> getAccountsPerName() {
return (Map<String, Account>) SOQL_Account.query().toMap(Account.Name);
}
public static Map<String, String> getAccountIndustryPerAccountId() {
return SOQL_Account.query().toMap(Account.Id, Account.Industry);
}
public static Map<String, List<Account>> getAccountsPerIndustry() {
return (Map<String, List<Account>>) SOQL_Account.query().toAggregatedMap(Account.Industry);
}
public static Map<String, List<String>> getAccountNamesPerIndustry() {
return SOQL_Account.query().toAggregatedMap(Account.Industry, Account.Name);
}
public static Database.QueryLocator getAccountQueryLocator() {
Expand Down

1 comment on commit 2bb5566

@vercel
Copy link

@vercel vercel bot commented on 2bb5566 Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.