@@ -24,15 +24,107 @@ Definition
24
24
25
25
.. code-block:: php
26
26
27
- function aggregate(array $pipeline, array $options = []): Traversable
27
+ function aggregate(
28
+ array $pipeline,
29
+ array $options = []
30
+ ): Traversable
28
31
29
- This method has the following parameters:
32
+ Parameters
33
+ ----------
34
+
35
+ ``$pipeline`` : array
36
+ Specifies an :manual:`aggregation pipeline </core/aggregation-pipeline>`
37
+ operation.
38
+
39
+ ``$options`` : array
40
+ An array specifying the desired options.
41
+
42
+ .. |parent| replace:: database
43
+
44
+ .. list-table::
45
+ :header-rows: 1
46
+ :widths: 20 20 80
47
+
48
+ * - Name
49
+ - Type
50
+ - Description
51
+
52
+ * - allowDiskUse
53
+ - boolean
54
+ - Enables writing to temporary files. When set to ``true``, aggregation
55
+ stages can write data to the ``_tmp`` sub-directory in the ``dbPath``
56
+ directory.
57
+
58
+ * - batchSize
59
+ - integer
60
+ - Specifies the batch size for the cursor, which will apply to both the
61
+ initial ``aggregate`` command and any subsequent ``getMore`` commands.
62
+ This determines the maximum number of documents to return in each
63
+ response from the server.
64
+
65
+ A batchSize of ``0`` is special in that and will only apply to the
66
+ initial ``aggregate`` command; subsequent ``getMore`` commands will use
67
+ the server's default batch size. This may be useful for quickly
68
+ returning a cursor or failure from ``aggregate`` without doing
69
+ significant server-side work.
70
+
71
+ * - bypassDocumentValidation
72
+ - boolean
73
+ - If ``true``, allows the write operation to circumvent document level
74
+ validation. Defaults to ``false``.
75
+
76
+ This only applies when using the :ref:`$out <agg-out>` and
77
+ :ref:`$out <agg-merge>` stages.
78
+
79
+ * - collation
80
+ - array|object
81
+ - .. include:: /includes/option-collation.rst
82
+
83
+ * - comment
84
+ - mixed
85
+ - .. include:: /includes/option-comment.rst
86
+
87
+ The comment can be any valid BSON type for server versions 4.4 and
88
+ above. Earlier server versions only support string values.
89
+
90
+ * - explain
91
+ - boolean
92
+ - Specifies whether or not to return the information on the processing of
93
+ the pipeline.
94
+
95
+ * - hint
96
+ - string|array|object
97
+ - .. include:: /includes/option-hint.rst
98
+
99
+ * - let
100
+ - array|object
101
+ - .. include:: /includes/option-let.rst
102
+
103
+ .. versionadded:: 1.9
104
+
105
+ * - maxTimeMS
106
+ - integer
107
+ - .. include:: /includes/option-maxTimeMS.rst
108
+
109
+ * - readConcern
110
+ - :php:`MongoDB\\Driver\\ReadConcern <class.mongodb-driver-readconcern>`
111
+ - .. include:: /includes/option-readConcern.rst
112
+
113
+ * - readPreference
114
+ - :php:`MongoDB\\Driver\\ReadPreference <class.mongodb-driver-readpreference>`
115
+ - .. include:: /includes/option-readPreference.rst
30
116
31
- .. include:: /includes/apiargs/MongoDBDatabase-method-aggregate-param.rst
117
+ * - session
118
+ - :php:`MongoDB\\Driver\\Session <class.mongodb-driver-session>`
119
+ - .. include:: /includes/option-session.rst
32
120
33
- The ``$options`` parameter supports the following options:
121
+ * - typeMap
122
+ - array
123
+ - .. include:: /includes/option-typeMap.rst
34
124
35
- .. include:: /includes/apiargs/MongoDBDatabase-method-aggregate-option.rst
125
+ * - writeConcern
126
+ - :php:`MongoDB\\Driver\\WriteConcern <class.mongodb-driver-writeconcern>`
127
+ - .. include:: /includes/option-writeConcern.rst
36
128
37
129
Return Values
38
130
-------------
0 commit comments