diff --git a/reference/mongo/mongocollection/aggregate.xml b/reference/mongo/mongocollection/aggregate.xml index 6984dbcdfb..6cf4b7e227 100644 --- a/reference/mongo/mongocollection/aggregate.xml +++ b/reference/mongo/mongocollection/aggregate.xml @@ -62,7 +62,32 @@ &reftitle.returnvalues; - The result of the aggregation as an array. + The result of the aggregation as an array. The ok will + be set to 1 on success, 0 on failure. + + + + + &reftitle.errors; + + When an error occurs an array with the following keys will be returned: + + + + errmsg - containing the reason for the failure + + + + + code - the errorcode of the failure + + + + + ok - will be set to 0. + + + @@ -126,32 +151,37 @@ var_dump($results); + ["result"]=> array(2) { - ["_id"]=> - array(1) { - ["tags"]=> - string(4) "good" + [0]=> + array(2) { + ["_id"]=> + array(1) { + ["tags"]=> + string(4) "good" + } + ["authors"]=> + array(1) { + [0]=> + string(3) "bob" + } } - ["authors"]=> - array(1) { - [0]=> - string(3) "bob" - } - } - [1]=> - array(2) { - ["_id"]=> - array(1) { - ["tags"]=> - string(3) "fun" - } - ["authors"]=> - array(1) { - [0]=> - string(3) "bob" + [1]=> + array(2) { + ["_id"]=> + array(1) { + ["tags"]=> + string(3) "fun" + } + ["authors"]=> + array(1) { + [0]=> + string(3) "bob" + } } } + ["ok"]=> + float(1) } ]]> @@ -191,29 +221,61 @@ var_dump($out); &example.outputs.similar; - array(2) { - ["_id"]=> - string(2) "TX" - ["totalPop"]=> - int(16986510) - } - [1]=> - array(2) { - ["_id"]=> - string(2) "PA" - ["totalPop"]=> - int(11881643) - } -.... - [6]=> - array(2) { - ["_id"]=> - string(2) "FL" - ["totalPop"]=> - int(12937926) +array(2) { + ["result"]=> + array(7) { + [0]=> + array(2) { + ["_id"]=> + string(2) "TX" + ["totalPop"]=> + int(16986510) + } + [1]=> + array(2) { + ["_id"]=> + string(2) "PA" + ["totalPop"]=> + int(11881643) + } + [2]=> + array(2) { + ["_id"]=> + string(2) "NY" + ["totalPop"]=> + int(17990455) + } + [3]=> + array(2) { + ["_id"]=> + string(2) "IL" + ["totalPop"]=> + int(11430602) + } + [4]=> + array(2) { + ["_id"]=> + string(2) "CA" + ["totalPop"]=> + int(29760021) + } + [5]=> + array(2) { + ["_id"]=> + string(2) "OH" + ["totalPop"]=> + int(10847115) + } + [6]=> + array(2) { + ["_id"]=> + string(2) "FL" + ["totalPop"]=> + int(12937926) + } } + ["ok"]=> + float(1) } ]]> @@ -252,36 +314,90 @@ var_dump($out); &example.outputs.similar; - array(2) { - ["_id"]=> - string(2) "DC" - ["avgCityPop"]=> - float(303450) - } - [1]=> - array(2) { - ["_id"]=> - string(2) "DE" - ["avgCityPop"]=> - float(14481.913043478) - } +array(2) { + ["result"]=> + array(51) { + [0]=> + array(2) { + ["_id"]=> + string(2) "DC" + ["avgCityPop"]=> + float(303450) + } + [1]=> + array(2) { + ["_id"]=> + string(2) "DE" + ["avgCityPop"]=> + float(14481.913043478) + } + [2]=> + array(2) { + ["_id"]=> + string(2) "RI" + ["avgCityPop"]=> + float(18933.283018868) + } + [3]=> + array(2) { + ["_id"]=> + string(2) "AL" + ["avgCityPop"]=> + float(7907.2152641879) + } + [4]=> + array(2) { + ["_id"]=> + string(2) "NH" + ["avgCityPop"]=> + float(5232.320754717) + } ... - [49]=> - array(2) { - ["_id"]=> - string(2) "WI" - ["avgCityPop"]=> - float(7323.0074850299) - } - [50]=> - array(2) { - ["_id"]=> - string(2) "WV" - ["avgCityPop"]=> - float(2759.1953846154) + [45]=> + array(2) { + ["_id"]=> + string(2) "WY" + ["avgCityPop"]=> + float(3359.9111111111) + } + [46]=> + array(2) { + ["_id"]=> + string(2) "MN" + ["avgCityPop"]=> + float(5335.4865853659) + } + [47]=> + array(2) { + ["_id"]=> + string(2) "OK" + ["avgCityPop"]=> + float(6155.7436399217) + } + [48]=> + array(2) { + ["_id"]=> + string(2) "IL" + ["avgCityPop"]=> + float(9931.0182450043) + } + [49]=> + array(2) { + ["_id"]=> + string(2) "WI" + ["avgCityPop"]=> + float(7323.0074850299) + } + [50]=> + array(2) { + ["_id"]=> + string(2) "WV" + ["avgCityPop"]=> + float(2759.1953846154) + } } + ["ok"]=> + float(1) } ]]>