Skip to content

Commit 4e7c4ad

Browse files
fieteboernerjenssegers
authored andcommitted
add documentation for subocument aggregation (#916)
1 parent 6c020a6 commit 4e7c4ad

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
@@ -405,6 +405,15 @@ Aggregations can be combined with **where**:
405405
$sold = Orders::where('sold', true)->sum('price');
406406
```
407407

408+
Aggregations can be also used on subdocuments:
409+
410+
```php
411+
$total = Order::max('suborder.price');
412+
...
413+
```
414+
415+
**NOTE**: this aggreagtion only works with single subdocuments (like embedsOne) not subdocument arrays (like embedsMany)
416+
408417
**Like**
409418

410419
```php

0 commit comments

Comments
 (0)