Skip to content

Commit 8451028

Browse files
committed
Specify when findAndModify operations may return null
1 parent ccebb5b commit 8451028

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Collection.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public function findOne($filter = [], array $options = [])
471471
/**
472472
* Finds a single document and deletes it, returning the original.
473473
*
474-
* The document to return may be null.
474+
* The document to return may be null if no document matched the filter.
475475
*
476476
* Note: BSON deserialization of the returned document does not yet support
477477
* a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
@@ -499,9 +499,10 @@ public function findOneAndDelete($filter, array $options = [])
499499
* Finds a single document and replaces it, returning either the original or
500500
* the replaced document.
501501
*
502-
* The document to return may be null. By default, the original document is
503-
* returned. Specify FindOneAndReplace::RETURN_DOCUMENT_AFTER for the
504-
* "returnDocument" option to return the updated document.
502+
* The document to return may be null if no document matched the filter. By
503+
* default, the original document is returned. Specify
504+
* FindOneAndReplace::RETURN_DOCUMENT_AFTER for the "returnDocument" option
505+
* to return the updated document.
505506
*
506507
* Note: BSON deserialization of the returned document does not yet support
507508
* a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
@@ -530,9 +531,10 @@ public function findOneAndReplace($filter, $replacement, array $options = [])
530531
* Finds a single document and updates it, returning either the original or
531532
* the updated document.
532533
*
533-
* The document to return may be null. By default, the original document is
534-
* returned. Specify FindOneAndUpdate::RETURN_DOCUMENT_AFTER for the
535-
* "returnDocument" option to return the updated document.
534+
* The document to return may be null if no document matched the filter. By
535+
* default, the original document is returned. Specify
536+
* FindOneAndUpdate::RETURN_DOCUMENT_AFTER for the "returnDocument" option
537+
* to return the updated document.
536538
*
537539
* Note: BSON deserialization of the returned document does not yet support
538540
* a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).

0 commit comments

Comments
 (0)