Skip to content

Commit ba37f0e

Browse files
committed
Replace apiargs for Collection methods
1 parent 128f5c0 commit ba37f0e

35 files changed

+2539
-182
lines changed

docs/reference/method/MongoDBCollection-aggregate.txt

Lines changed: 116 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,126 @@ Definition
2020

2121
.. code-block:: php
2222

23-
function aggregate(array $pipeline, array $options = []): Traversable
23+
function aggregate(
24+
array $pipeline,
25+
array $options = []
26+
): Traversable
2427

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

27-
.. include:: /includes/apiargs/MongoDBCollection-method-aggregate-param.rst
132+
* - writeConcern
133+
- :php:`MongoDB\\Driver\\WriteConcern <class.mongodb-driver-writeconcern>`
134+
- .. include:: /includes/extracts/collection-option-writeConcern.rst
28135

29-
The ``$options`` parameter supports the following options:
136+
It is not possible to specify a :manual:`write concern
137+
</reference/write-concern>` for individual operations as part of a
138+
transaction. Instead, set the ``writeConcern`` option when starting the
139+
transaction with :php:`startTransaction <mongodb-driver-session.starttransaction>`.
30140

31-
.. include:: /includes/apiargs/MongoDBCollection-method-aggregate-option.rst
141+
This only applies when a :ref:`$out <agg-out>` or
142+
:ref:`$merge <agg-merge>` stage is specified.
32143

33144
Return Values
34145
-------------

docs/reference/method/MongoDBCollection-bulkWrite.txt

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,96 @@ Definition
1919

2020
.. code-block:: php
2121

22-
function bulkWrite(array $operations, array $options = []): MongoDB\BulkWriteResult
22+
function bulkWrite(
23+
array $operations,
24+
array $options = []
25+
): MongoDB\BulkWriteResult
2326

24-
This method has the following parameters:
27+
Parameters
28+
----------
29+
30+
``$operations`` : array
31+
An array containing the write operations to perform.
32+
:phpmethod:`MongoDB\\Collection::bulkWrite()` supports
33+
:phpmethod:`deleteMany() <MongoDB\\Collection::deleteMany>`,
34+
:phpmethod:`deleteOne() <MongoDB\\Collection::deleteOne>`,
35+
:phpmethod:`insertOne() <MongoDB\\Collection::insertOne>`,
36+
:phpmethod:`replaceOne() <MongoDB\\Collection::replaceOne>`,
37+
:phpmethod:`updateMany() <MongoDB\\Collection::updateMany>`, and
38+
:phpmethod:`updateOne() <MongoDB\\Collection::updateOne>` operations in the
39+
following array structure:
40+
41+
.. code-block:: php
42+
43+
[
44+
[ 'deleteMany' => [ $filter ] ],
45+
[ 'deleteOne' => [ $filter ] ],
46+
[ 'insertOne' => [ $document ] ],
47+
[ 'replaceOne' => [ $filter, $replacement, $options ] ],
48+
[ 'updateMany' => [ $filter, $update, $options ] ],
49+
[ 'updateOne' => [ $filter, $update, $options ] ],
50+
]
51+
52+
Arguments correspond to the respective operation methods. However, the
53+
``writeConcern`` option is specified as a top-level option to
54+
:phpmethod:`MongoDB\\Collection::bulkWrite()` instead of each individual
55+
operation.
56+
57+
``$options`` : array
58+
An array specifying the desired options.
59+
60+
.. list-table::
61+
:header-rows: 1
62+
:widths: 20 20 80
63+
64+
* - Name
65+
- Type
66+
- Description
67+
68+
* - bypassDocumentValidation
69+
- boolean
70+
- If ``true``, allows the write operation to circumvent document level
71+
validation. Defaults to ``false``.
72+
73+
* - comment
74+
- mixed
75+
- .. include:: /includes/extracts/common-option-comment.rst
76+
77+
This is not supported for server versions prior to 4.4 and will result
78+
in an exception at execution time if used.
79+
80+
.. versionadded:: 1.13
81+
82+
* - let
83+
- array|object
84+
- .. include:: /includes/extracts/common-option-let.rst
85+
86+
.. versionadded:: 1.13
87+
88+
* - ordered
89+
- boolean
90+
- If ``true``: when a single write fails, the operation will stop without
91+
performing the remaining writes and throw an exception.
92+
93+
If ``false``: when a single write fails, the operation will continue
94+
with the remaining writes, if any, and throw an exception.
95+
96+
The default is ``true``.
97+
98+
* - session
99+
- :php:`MongoDB\\Driver\\Session <class.mongodb-driver-session>`
100+
- .. include:: /includes/extracts/common-option-session.rst
25101

26-
.. include:: /includes/apiargs/MongoDBCollection-method-bulkWrite-param.rst
102+
.. versionadded:: 1.3
27103

28-
The ``$options`` parameter supports the following options:
104+
* - writeConcern
105+
- :php:`MongoDB\\Driver\\WriteConcern <class.mongodb-driver-writeconcern>`
106+
- .. include:: /includes/extracts/collection-option-writeConcern.rst
29107

30-
.. include:: /includes/apiargs/MongoDBCollection-method-bulkWrite-option.rst
108+
It is not possible to specify a :manual:`write concern
109+
</reference/write-concern>` for individual operations as part of a
110+
transaction. Instead, set the ``writeConcern`` option when starting the
111+
transaction with :php:`startTransaction <mongodb-driver-session.starttransaction>`.
31112

32113
Return Values
33114
-------------

docs/reference/method/MongoDBCollection-count.txt

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,81 @@ Definition
2121

2222
.. code-block:: php
2323

24-
function count(array|object $filter = [], array $options = []): integer
24+
function count(
25+
array|object $filter = [],
26+
array $options = []
27+
): integer
2528

26-
This method has the following parameters:
29+
Parameters
30+
----------
31+
32+
``$filter`` : array|object
33+
The filter criteria that specifies the documents to count.
34+
35+
``$options`` : array
36+
An array specifying the desired options.
37+
38+
.. list-table::
39+
:header-rows: 1
40+
:widths: 20 20 80
41+
42+
* - Name
43+
- Type
44+
- Description
45+
46+
* - collation
47+
- array|object
48+
- .. include:: /includes/extracts/collection-option-collation.rst
49+
50+
* - comment
51+
- mixed
52+
- .. include:: /includes/extracts/common-option-comment.rst
53+
54+
This is not supported for server versions prior to 4.4 and will result
55+
in an exception at execution time if used.
56+
57+
.. versionadded:: 1.13
58+
59+
* - hint
60+
- string|array|object
61+
- .. include:: /includes/extracts/common-option-hint.rst
62+
63+
.. versionchanged:: 1.2
64+
65+
If a document is provided, it is passed to the command as-is.
66+
Previously, the library would convert the key pattern to an index
67+
name.
68+
69+
* - limit
70+
- integer
71+
- The maximum number of matching documents to return.
72+
73+
* - maxTimeMS
74+
- integer
75+
- .. include:: /includes/extracts/common-option-maxTimeMS.rst
76+
77+
* - readConcern
78+
- :php:`MongoDB\\Driver\\ReadConcern <class.mongodb-driver-readconcern>`
79+
- .. include:: /includes/extracts/collection-option-readConcern.rst
80+
81+
It is not possible to specify a :manual:`read concern
82+
</reference/read-concern>` for individual operations as part of a
83+
transaction. Instead, set the ``readConcern`` option when starting the
84+
transaction with :php:`startTransaction <mongodb-driver-session.starttransaction>`.
85+
86+
* - readPreference
87+
- :php:`MongoDB\\Driver\\ReadPreference <class.mongodb-driver-readpreference>`
88+
- .. include:: /includes/extracts/collection-option-readPreference.rst
2789

28-
.. include:: /includes/apiargs/MongoDBCollection-method-count-param.rst
90+
* - session
91+
- :php:`MongoDB\\Driver\\Session <class.mongodb-driver-session>`
92+
- .. include:: /includes/extracts/common-option-session.rst
2993

30-
The ``$options`` parameter supports the following options:
94+
.. versionadded:: 1.3
3195

32-
.. include:: /includes/apiargs/MongoDBCollection-method-count-option.rst
96+
* - skip
97+
- integer
98+
- The number of matching documents to skip before returning results.
3399

34100
Return Values
35101
-------------

docs/reference/method/MongoDBCollection-countDocuments.txt

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,66 @@ Definition
2323

2424
function countDocuments(array|object $filter = [], array $options = []): integer
2525

26-
This method has the following parameters:
26+
Parameters
27+
----------
28+
29+
``$filter`` : array|object
30+
The filter criteria that specifies the documents to count.
31+
32+
``$options`` : array
33+
An array specifying the desired options.
34+
35+
.. list-table::
36+
:header-rows: 1
37+
:widths: 20 20 80
38+
39+
* - Name
40+
- Type
41+
- Description
42+
43+
* - collation
44+
- array|object
45+
- .. include:: /includes/extracts/collection-option-collation.rst
46+
47+
* - comment
48+
- mixed
49+
- .. include:: /includes/extracts/common-option-comment.rst
50+
51+
The comment can be any valid BSON type for server versions 4.4 and above.
52+
Earlier server versions only support string values.
53+
54+
* - hint
55+
- string|array|object
56+
- .. include:: /includes/extracts/common-option-hint.rst
57+
58+
* - limit
59+
- integer
60+
- The maximum number of matching documents to return.
61+
62+
* - maxTimeMS
63+
- integer
64+
- .. include:: /includes/extracts/common-option-maxTimeMS.rst
65+
66+
* - readConcern
67+
- :php:`MongoDB\\Driver\\ReadConcern <class.mongodb-driver-readconcern>`
68+
- .. include:: /includes/extracts/collection-option-readConcern.rst
69+
70+
It is not possible to specify a :manual:`read concern
71+
</reference/read-concern>` for individual operations as part of a
72+
transaction. Instead, set the ``readConcern`` option when starting the
73+
transaction with :php:`startTransaction <mongodb-driver-session.starttransaction>`.
2774

28-
.. include:: /includes/apiargs/MongoDBCollection-method-countDocuments-param.rst
75+
* - readPreference
76+
- :php:`MongoDB\\Driver\\ReadPreference <class.mongodb-driver-readpreference>`
77+
- .. include:: /includes/extracts/collection-option-readPreference.rst
2978

30-
The ``$options`` parameter supports the following options:
79+
* - session
80+
- :php:`MongoDB\\Driver\\Session <class.mongodb-driver-session>`
81+
- .. include:: /includes/extracts/common-option-session.rst
3182

32-
.. include:: /includes/apiargs/MongoDBCollection-method-countDocuments-option.rst
83+
* - skip
84+
- integer
85+
- The number of matching documents to skip before returning results.
3386

3487
Return Values
3588
-------------

0 commit comments

Comments
 (0)