Commit 4e7c4ad1 authored by Fiete Börner's avatar Fiete Börner Committed by Jens Segers

add documentation for subocument aggregation (#916)

parent 6c020a63
...@@ -405,6 +405,15 @@ Aggregations can be combined with **where**: ...@@ -405,6 +405,15 @@ Aggregations can be combined with **where**:
$sold = Orders::where('sold', true)->sum('price'); $sold = Orders::where('sold', true)->sum('price');
``` ```
Aggregations can be also used on subdocuments:
```php
$total = Order::max('suborder.price');
...
```
**NOTE**: this aggreagtion only works with single subdocuments (like embedsOne) not subdocument arrays (like embedsMany)
**Like** **Like**
```php ```php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment