Skip to content

Commit b33e5a5

Browse files
committed
Update MongoDB\Collection documentation
1 parent b12430a commit b33e5a5

File tree

63 files changed

+1037
-1128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1037
-1128
lines changed

docs/includes/apiargs-MongoDBCollection-method-aggregate-option.yaml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ arg_name: option
22
name: allowDiskUse
33
type: boolean
44
description: |
5-
Enables writing to temporary files. When set to true, aggregation
6-
stages can write data to the ``_tmp`` sub-directory in the dbPath
7-
directory. The default is ``false``.
5+
Enables writing to temporary files. When set to ``true``, aggregation stages
6+
can write data to the ``_tmp`` sub-directory in the dbPath directory.
7+
The default is ``false``.
88
interface: phpmethod
99
operation: MongoDB\\Collection::aggregate
1010
optional: true
@@ -21,53 +21,63 @@ optional: true
2121
position: 2
2222
---
2323
source:
24-
ref: bypassDocumentValidation
2524
file: apiargs-common-option.yaml
25+
ref: bypassDocumentValidation
2626
operation: MongoDB\\Collection::aggregate
27-
position: 5
27+
position: 3
2828
---
2929
source:
30-
ref: maxTimeMS
3130
file: apiargs-common-option.yaml
31+
ref: maxTimeMS
3232
operation: MongoDB\\Collection::aggregate
3333
position: 4
3434
---
3535
source:
36-
ref: readConcern
3736
file: apiargs-common-option.yaml
38-
operation: MongoDB\\Collection::selectDatabase
37+
ref: readConcern
38+
operation: MongoDB\\Collection::aggregate
39+
position: 5
3940
replacement:
4041
resource: "aggregation"
41-
position: 5
42+
parent: "collection"
4243
---
4344
source:
44-
ref: readPreference
4545
file: apiargs-common-option.yaml
46-
operation: MongoDB\\Collection::selectDatabase
46+
ref: readPreference
47+
operation: MongoDB\\Collection::aggregate
48+
position: 6
4749
replacement:
4850
resource: "aggregation"
49-
position: 6
51+
parent: "collection"
5052
---
5153
source:
52-
ref: typeMap
5354
file: apiargs-common-option.yaml
54-
operation: MongoDB\\Collection::selectDatabase
55+
ref: typeMap
56+
operation: MongoDB\\Collection::aggregate
5557
position: 7
58+
description: |
59+
Type map for BSON deserialization. This will be applied to the returned
60+
cursor. Defaults to the collections's type map.
61+
62+
.. note::
63+
64+
This is not supported for inline aggregation results (i.e. ``useCursor``
65+
option is ``false`` or the server version is < 2.6).
5666
---
5767
arg_name: param
5868
name: useCursor
5969
type: boolean
6070
description: |
61-
Indicates whether the command will request that the server provide
62-
results using a cursor. The default is ``true``.
71+
Indicates whether the command will request that the server provide results
72+
using a cursor. The default is ``true``.
6373
64-
For MongoDB version 2.6 or later, ``useCursor`` allows users to turn
65-
off cursors if necessary to aid in mongod/mongos upgrades.
74+
For MongoDB version 2.6 or later, ``useCursor`` allows users to turn off
75+
cursors if necessary to aid in replica set or shard cluster upgrades.
6676
67-
``useCursor`` is ignored for MongoDB versions prior to 2.6 as
68-
aggregation cursors are not available pre-2.6.
77+
``useCursor`` is ignored for MongoDB versions prior to 2.6 as aggregation
78+
cursors are not available.
6979
interface: phpmethod
7080
operation: MongoDB\\Collection::aggregate
7181
optional: true
72-
position: 8
82+
position: 8
7383
...

docs/includes/apiargs-MongoDBCollection-method-aggregate-param.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ arg_name: param
22
name: $pipeline
33
type: array
44
description: |
5-
Specifies an :manual:`aggregation pipeline </core/aggregation-pipeline>` operation.
5+
Specifies an :manual:`aggregation pipeline </core/aggregation-pipeline>`
6+
operation.
67
interface: phpmethod
78
operation: MongoDB\\Collection::aggregate
8-
optional: true
99
position: 1
1010
---
1111
source:
12-
ref: $options
1312
file: apiargs-common-param.yaml
13+
ref: $options
1414
operation: MongoDB\\Collection::aggregate
1515
position: 2
16-
...
16+
...
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
source:
2-
ref: bypassDocumentValidation
32
file: apiargs-common-option.yaml
3+
ref: bypassDocumentValidation
44
operation: MongoDB\\Collection::bulkWrite
55
position: 1
66
---
77
arg_name: option
88
name: ordered
99
type: boolean
1010
description: |
11-
If ``true``: when an insert fails, the operation returns without performing the
12-
remaining writes.
13-
14-
If ``false``: when a write fails, the operation will continue with the
15-
remaining writes, if any.
16-
11+
If ``true``: when a single write fails, the operation returns without
12+
performing the remaining writes.
13+
14+
If ``false``: when a single write fails, the operation will continue with the
15+
remaining writes, if any.
16+
1717
The default is ``true``.
18-
optional: true
1918
interface: phpmethod
2019
operation: MongoDB\\Collection::bulkWrite
20+
optional: true
2121
position: 2
2222
---
2323
source:
24-
ref: writeConcern
2524
file: apiargs-common-option.yaml
25+
ref: writeConcern
2626
operation: MongoDB\\Collection::bulkWrite
2727
replacement:
2828
resource: "write"
29+
parent: "collection"
2930
position: 3
3031
...

docs/includes/apiargs-MongoDBCollection-method-bulkWrite-param.yaml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ arg_name: param
22
name: $operations
33
type: array
44
description: |
5-
An array containing the write operations to perform. {{role}}
6-
supports :phpmethod:`deleteMany <MongoDB\\Collection::deleteMany>`,
7-
:phpmethod:`deleteOne <MongoDB\\Collection::deleteOne>`, :phpmethod:`insertOne
8-
<MongoDB\\Collection::insertOne>`, :phpmethod:`replaceOne
9-
<MongoDB\\Collection::replaceOne>`, :phpmethod:`updateMany
10-
<MongoDB\\Collection::updateMany>`, and :phpmethod:`updateOne
11-
<MongoDB\\Collection::updateOne>` operations in the following array
12-
structure:
13-
5+
An array containing the write operations to perform.
6+
:phpmethod:`MongoDB\\Collection::bulkWrite()` supports
7+
:phpmethod:`deleteMany() <MongoDB\\Collection::deleteMany>`,
8+
:phpmethod:`deleteOne() <MongoDB\\Collection::deleteOne>`,
9+
:phpmethod:`insertOne() <MongoDB\\Collection::insertOne>`,
10+
:phpmethod:`replaceOne() <MongoDB\\Collection::replaceOne>`,
11+
:phpmethod:`updateMany() <MongoDB\\Collection::updateMany>`, and
12+
:phpmethod:`updateOne() <MongoDB\\Collection::updateOne>` operations in the
13+
following array structure:
14+
1415
.. code-block:: php
15-
16+
1617
[
1718
[ 'deleteMany' => [ $filter ] ],
1819
[ 'deleteOne' => [ $filter ] ],
@@ -22,18 +23,19 @@ description: |
2223
[ 'updateOne' => [ $filter, $update, $options ] ],
2324
]
2425
post: |
25-
Arguments correspond to the respective operation methods. However,
26-
the ``writeConcern`` option is specified for the top-level bulk write
27-
operation instead of each individual operation.
26+
Arguments correspond to the respective operation methods. However, the
27+
``writeConcern`` option is specified as a top-level option to
28+
:phpmethod:`MongoDB\\Collection::bulkWrite()` instead of each individual
29+
operation.
2830
interface: phpmethod
2931
operation: MongoDB\\Collection::bulkWrite
3032
optional: true
3133
position: 1
3234
---
3335
source:
34-
ref: $options
3536
file: apiargs-common-param.yaml
37+
ref: $options
3638
operation: MongoDB\\Collection::bulkWrite
3739
interface: phpmethod
3840
position: 2
39-
...
41+
...
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
source:
2+
file: apiargs-common-option.yaml
3+
ref: readConcern
4+
operation: MongoDB\\Collection::__construct
5+
position: 1
6+
replacement:
7+
resource: "collection"
8+
parent: "manager"
9+
---
10+
source:
11+
file: apiargs-common-option.yaml
12+
ref: readPreference
13+
operation: MongoDB\\Collection::__construct
14+
position: 2
15+
replacement:
16+
resource: "collection"
17+
parent: "manager"
18+
---
19+
arg_name: option
20+
name: typeMap
21+
type: array
22+
description: |
23+
Default :php:`type map
24+
<manual/en/mongodb.persistence.deserialization.php#mongodb.persistence.typemaps>`
25+
to apply to cursors. The type map determines how BSON documents are converted
26+
to PHP values which determines. The |php-library| uses the following type map
27+
by default:
28+
29+
.. code-block:: php
30+
31+
[
32+
'array' => 'MongoDB\Model\BSONArray',
33+
'document' => 'MongoDB\Model\BSONDocument',
34+
'root' => 'MongoDB\Model\BSONDocument',
35+
]
36+
interface: phpmethod
37+
operation: MongoDB\\Collection::__construct
38+
optional: true
39+
position: 3
40+
---
41+
source:
42+
file: apiargs-common-option.yaml
43+
ref: writeConcern
44+
operation: MongoDB\\Collection::__construct
45+
position: 4
46+
replacement:
47+
resource: "collection"
48+
parent: "manager"
49+
...
Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
1-
arg_name: param
2-
name: $manager
3-
type: :php:`MongoDB\\Driver\\Manager <class.mongodb-driver-manager>`
4-
description: |
5-
The :php:`Manager <mongodb-driver-manager>` instance from the driver.
6-
The manager maintains connections between the driver and your MongoDB
7-
instances.
8-
interface: phpmethod
1+
source:
2+
file: apiargs-common-param.yaml
3+
ref: $manager
94
operation: MongoDB\\Collection::__construct
10-
optional: false
115
position: 1
126
---
137
source:
14-
ref: $databaseName
158
file: apiargs-common-param.yaml
9+
ref: $databaseName
1610
operation: MongoDB\\Collection::__construct
17-
replacement:
18-
select: ""
1911
position: 2
2012
---
2113
source:
22-
ref: $collectionName
2314
file: apiargs-common-param.yaml
15+
ref: $collectionName
2416
operation: MongoDB\\Collection::__construct
25-
replacement:
26-
select: ""
2717
position: 3
2818
---
2919
source:
30-
ref: $options
3120
file: apiargs-common-param.yaml
21+
ref: $options
3222
operation: MongoDB\\Collection::__construct
3323
position: 4
34-
...
24+
...
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
arg_name: option
22
name: hint
3-
type: string or array|object
3+
type: string|array|object
44
description: |
5-
The index to use. If you specify a document, it is interpreted as
6-
an index specification and a name will be generated.
7-
optional: true
5+
The index to use. If you specify a document, it is interpreted as an index
6+
specification and a name will be generated.
87
interface: phpmethod
98
operation: MongoDB\\Collection::count
9+
optional: true
1010
position: 1
1111
---
1212
arg_name: option
1313
name: limit
1414
type: integer
1515
description: |
1616
The maximum number of documents to return.
17-
optional: true
1817
interface: phpmethod
1918
operation: MongoDB\\Collection::count
19+
optional: true
2020
position: 2
2121
---
2222
source:
23-
ref: maxTimeMS
2423
file: apiargs-common-option.yaml
24+
ref: maxTimeMS
2525
operation: MongoDB\\Collection::count
2626
position: 3
2727
---
@@ -31,22 +31,24 @@ source:
3131
operation: MongoDB\\Collection::count
3232
replacement:
3333
resource: "count"
34+
parent: "collection"
3435
position: 4
3536
---
3637
source:
3738
ref: readPreference
3839
file: apiargs-common-option.yaml
3940
replacement:
4041
resource: "count"
42+
parent: "collection"
4143
position: 5
4244
---
4345
arg_name: option
4446
name: skip
4547
type: integer
4648
description: |
4749
The number of documents to skip before returning the documents.
48-
optional: true
4950
interface: phpmethod
5051
operation: MongoDB\\Collection::count
52+
optional: true
5153
position: 6
5254
...
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
source:
2-
ref: $filter
32
file: apiargs-common-param.yaml
3+
ref: $filter
44
operation: MongoDB\\Collection::count
55
position: 1
66
---
77
source:
8-
ref: $options
98
file: apiargs-common-param.yaml
9+
ref: $options
1010
operation: MongoDB\\Collection::count
1111
position: 2
1212
...

0 commit comments

Comments
 (0)