Skip to content

Commit ce03df6

Browse files
committed
add documentation for subocument aggregation (mongodb#916)
1 parent 5e66d3f commit ce03df6

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)