From 4b724b38e47b320c44e799edcda335599b7dfb5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fiete=20B=C3=B6rner?= Date: Wed, 10 Aug 2016 23:25:04 +0200 Subject: [PATCH] add documentation for subocument aggregation --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 2a1263ec7..354b5db5b 100644 --- a/README.md +++ b/README.md @@ -405,6 +405,15 @@ Aggregations can be combined with **where**: $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** ```php