Skip to content

Commit 8117675

Browse files
committed
Merge pull request #290
2 parents 79e1221 + f0090c8 commit 8117675

14 files changed

+250
-25
lines changed

docs/includes/apiargs-MongoDBDatabase-method-selectGridFSBucket-option.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ replacement:
3131
resource: "bucket"
3232
parent: "database"
3333
---
34+
source:
35+
file: apiargs-common-option.yaml
36+
ref: typeMap
37+
replacement:
38+
parent: "database"
39+
---
3440
source:
3541
file: apiargs-common-option.yaml
3642
ref: writeConcern

docs/includes/apiargs-MongoDBGridFSBucket-method-construct-option.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ replacement:
3131
resource: "bucket"
3232
parent: "database"
3333
---
34+
source:
35+
file: apiargs-MongoDBClient-method-construct-driverOptions.yaml
36+
ref: typeMap
37+
---
3438
source:
3539
file: apiargs-common-option.yaml
3640
ref: writeConcern
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
source:
2+
file: apiargs-MongoDBCollection-method-find-option.yaml
3+
ref: projection
4+
---
5+
source:
6+
file: apiargs-MongoDBCollection-method-find-option.yaml
7+
ref: sort
8+
---
9+
source:
10+
file: apiargs-MongoDBCollection-method-find-option.yaml
11+
ref: skip
12+
---
13+
source:
14+
file: apiargs-MongoDBCollection-common-option.yaml
15+
ref: collation
16+
---
17+
source:
18+
file: apiargs-MongoDBCollection-method-find-option.yaml
19+
ref: comment
20+
---
21+
source:
22+
file: apiargs-common-option.yaml
23+
ref: maxTimeMS
24+
---
25+
source:
26+
file: apiargs-MongoDBCollection-method-find-option.yaml
27+
ref: readConcern
28+
---
29+
source:
30+
file: apiargs-MongoDBGridFSBucket-method-find-option.yaml
31+
ref: readPreference
32+
---
33+
source:
34+
file: apiargs-MongoDBGridFSBucket-method-find-option.yaml
35+
ref: typeMap
36+
post: |
37+
This will be used for the returned result document.
38+
---
39+
source:
40+
file: apiargs-MongoDBCollection-method-find-option.yaml
41+
ref: modifiers
42+
...

docs/reference/class/MongoDBGridFSBucket.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Methods
4040
/reference/method/MongoDBGridFSBucket-downloadToStreamByName
4141
/reference/method/MongoDBGridFSBucket-drop
4242
/reference/method/MongoDBGridFSBucket-find
43+
/reference/method/MongoDBGridFSBucket-findOne
4344
/reference/method/MongoDBGridFSBucket-getBucketName
4445
/reference/method/MongoDBGridFSBucket-getDatabaseName
4546
/reference/method/MongoDBGridFSBucket-getFileDocumentForStream

docs/reference/method/MongoDBCollection-findOne.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ Definition
3232
Return Values
3333
-------------
3434

35-
An array or object for the :term:`first document <natural order>` document that
36-
matched the query, or ``null`` if no document matched the query. The return type
37-
will depend on the ``typeMap`` option.
35+
An array or object for the :term:`first document <natural order>` that matched
36+
the query, or ``null`` if no document matched the query. The return type will
37+
depend on the ``typeMap`` option.
3838

3939
Errors/Exceptions
4040
-----------------

docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Errors/Exceptions
4242
Behavior
4343
--------
4444

45-
The selected bucket inherits options such as read preference and write concern
46-
from the :phpclass:`Database <MongoDB\\Database>` object. Options may be
45+
The selected bucket inherits options such as read preference and type
46+
mapping from the :phpclass:`Database <MongoDB\\Database>` object. Options may be
4747
overridden via the ``$options`` parameter.
4848

4949
Example

docs/reference/method/MongoDBGridFSBucket-find.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ See Also
4040
--------
4141

4242
- :phpmethod:`MongoDB\\Collection::find()`
43+
- :phpmethod:`MongoDB\\GridFS\\Bucket::findOne()`
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
==================================
2+
MongoDB\\GridFS\\Bucket::findOne()
3+
==================================
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
Definition
14+
----------
15+
16+
.. phpmethod:: MongoDB\\GridFS\\Bucket::findOne()
17+
18+
Finds a single document from the GridFS bucket's files collection matching
19+
the query.
20+
21+
.. code-block:: php
22+
23+
function findOne($filter = [], array $options = []): array|object|null
24+
25+
This method has the following parameters:
26+
27+
.. include:: /includes/apiargs/MongoDBCollection-method-findOne-param.rst
28+
29+
The ``$options`` parameter supports the following options:
30+
31+
.. include:: /includes/apiargs/MongoDBGridFSBucket-method-findOne-option.rst
32+
33+
Return Values
34+
-------------
35+
36+
An array or object for the :term:`first document <natural order>` that matched
37+
the query, or ``null`` if no document matched the query. The return type will
38+
depend on the ``typeMap`` option.
39+
40+
.. todo: add examples
41+
42+
See Also
43+
--------
44+
45+
- :phpmethod:`MongoDB\\Collection::findOne()`
46+
- :phpmethod:`MongoDB\\GridFS\\Bucket::find()`

docs/reference/method/MongoDBGridFSBucket-getFileDocumentForStream.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Definition
1919

2020
.. code-block:: php
2121

22-
function getFileDocumentForStream($stream): object
22+
function getFileDocumentForStream($stream): array|object
2323

2424
This method has the following parameters:
2525

@@ -28,7 +28,8 @@ Definition
2828
Return Values
2929
-------------
3030

31-
The metadata document associated with the GridFS stream.
31+
The metadata document associated with the GridFS stream. The return type will
32+
depend on the bucket's ``typeMap`` option.
3233

3334
.. todo: add examples
3435

docs/reference/method/MongoDBGridFSBucket-getFileIdForStream.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Definition
2828
Return Values
2929
-------------
3030

31-
The ``_id`` field of the metadata document associated with the GridFS
32-
stream.
31+
The ``_id`` field of the metadata document associated with the GridFS stream.
32+
The return type will depend on the bucket's ``typeMap`` option.
3333

3434
.. todo: add examples
3535

0 commit comments

Comments
 (0)