@@ -553,14 +553,11 @@ public function findOne($filter = [], array $options = [])
553
553
*
554
554
* The document to return may be null if no document matched the filter.
555
555
*
556
- * Note: BSON deserialization of the returned document does not yet support
557
- * a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
558
- *
559
556
* @see FindOneAndDelete::__construct() for supported options
560
557
* @see http://docs.mongodb.org/manual/reference/command/findAndModify/
561
558
* @param array|object $filter Query by which to filter documents
562
559
* @param array $options Command options
563
- * @return object|null
560
+ * @return array| object|null
564
561
* @throws UnexpectedValueException if the command response was malformed
565
562
* @throws UnsupportedException if options are not supported by the selected server
566
563
* @throws InvalidArgumentException for parameter/option parsing errors
@@ -574,6 +571,10 @@ public function findOneAndDelete($filter, array $options = [])
574
571
$ options ['writeConcern ' ] = $ this ->writeConcern ;
575
572
}
576
573
574
+ if ( ! isset ($ options ['typeMap ' ])) {
575
+ $ options ['typeMap ' ] = $ this ->typeMap ;
576
+ }
577
+
577
578
$ operation = new FindOneAndDelete ($ this ->databaseName , $ this ->collectionName , $ filter , $ options );
578
579
579
580
return $ operation ->execute ($ server );
@@ -588,15 +589,12 @@ public function findOneAndDelete($filter, array $options = [])
588
589
* FindOneAndReplace::RETURN_DOCUMENT_AFTER for the "returnDocument" option
589
590
* to return the updated document.
590
591
*
591
- * Note: BSON deserialization of the returned document does not yet support
592
- * a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
593
- *
594
592
* @see FindOneAndReplace::__construct() for supported options
595
593
* @see http://docs.mongodb.org/manual/reference/command/findAndModify/
596
594
* @param array|object $filter Query by which to filter documents
597
595
* @param array|object $replacement Replacement document
598
596
* @param array $options Command options
599
- * @return object|null
597
+ * @return array| object|null
600
598
* @throws UnexpectedValueException if the command response was malformed
601
599
* @throws UnsupportedException if options are not supported by the selected server
602
600
* @throws InvalidArgumentException for parameter/option parsing errors
@@ -610,6 +608,10 @@ public function findOneAndReplace($filter, $replacement, array $options = [])
610
608
$ options ['writeConcern ' ] = $ this ->writeConcern ;
611
609
}
612
610
611
+ if ( ! isset ($ options ['typeMap ' ])) {
612
+ $ options ['typeMap ' ] = $ this ->typeMap ;
613
+ }
614
+
613
615
$ operation = new FindOneAndReplace ($ this ->databaseName , $ this ->collectionName , $ filter , $ replacement , $ options );
614
616
615
617
return $ operation ->execute ($ server );
@@ -624,15 +626,12 @@ public function findOneAndReplace($filter, $replacement, array $options = [])
624
626
* FindOneAndUpdate::RETURN_DOCUMENT_AFTER for the "returnDocument" option
625
627
* to return the updated document.
626
628
*
627
- * Note: BSON deserialization of the returned document does not yet support
628
- * a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
629
- *
630
629
* @see FindOneAndReplace::__construct() for supported options
631
630
* @see http://docs.mongodb.org/manual/reference/command/findAndModify/
632
631
* @param array|object $filter Query by which to filter documents
633
632
* @param array|object $update Update to apply to the matched document
634
633
* @param array $options Command options
635
- * @return object|null
634
+ * @return array| object|null
636
635
* @throws UnexpectedValueException if the command response was malformed
637
636
* @throws UnsupportedException if options are not supported by the selected server
638
637
* @throws InvalidArgumentException for parameter/option parsing errors
@@ -646,6 +645,10 @@ public function findOneAndUpdate($filter, $update, array $options = [])
646
645
$ options ['writeConcern ' ] = $ this ->writeConcern ;
647
646
}
648
647
648
+ if ( ! isset ($ options ['typeMap ' ])) {
649
+ $ options ['typeMap ' ] = $ this ->typeMap ;
650
+ }
651
+
649
652
$ operation = new FindOneAndUpdate ($ this ->databaseName , $ this ->collectionName , $ filter , $ update , $ options );
650
653
651
654
return $ operation ->execute ($ server );
0 commit comments