Skip to content

Commit 5274d2c

Browse files
author
Fiete Börner
committed
add documentation for subocument aggregation
1 parent 78a5a05 commit 5274d2c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,15 @@ Aggregations can be combined with **where**:
389389
$sold = Orders::where('sold', true)->sum('price');
390390
```
391391

392+
Aggregations can be also used on subdocuments:
393+
394+
```php
395+
$total = Order::max('suborder.price');
396+
...
397+
```
398+
399+
**NOTE**: this aggreagtion only works with single subdocuments (like embedsOne) not subdocument arrays (like embedsMany)
400+
392401
**Like**
393402

394403
```php

0 commit comments

Comments
 (0)