5
5
use MongoDB \BSON \ObjectId ;
6
6
use MongoDB \Driver \Cursor ;
7
7
use MongoDB \Driver \Manager ;
8
+ use MongoDB \Driver \ReadConcern ;
8
9
use MongoDB \Driver \ReadPreference ;
9
10
use MongoDB \Driver \WriteConcern ;
10
11
use MongoDB \Exception \InvalidArgumentException ;
@@ -38,6 +39,8 @@ class Bucket
38
39
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to
39
40
* 261120 (i.e. 255 KiB).
40
41
*
42
+ * * readConcern (MongoDB\Driver\ReadConcern): Read concern.
43
+ *
41
44
* * readPreference (MongoDB\Driver\ReadPreference): Read preference.
42
45
*
43
46
* * writeConcern (MongoDB\Driver\WriteConcern): Write concern.
@@ -62,6 +65,10 @@ public function __construct(Manager $manager, $databaseName, array $options = []
62
65
throw InvalidArgumentException::invalidType ('"chunkSizeBytes" option ' , $ options ['chunkSizeBytes ' ], 'integer ' );
63
66
}
64
67
68
+ if (isset ($ options ['readConcern ' ]) && ! $ options ['readConcern ' ] instanceof ReadConcern) {
69
+ throw InvalidArgumentException::invalidType ('"readConcern" option ' , $ options ['readConcern ' ], 'MongoDB\Driver\ReadConcern ' );
70
+ }
71
+
65
72
if (isset ($ options ['readPreference ' ]) && ! $ options ['readPreference ' ] instanceof ReadPreference) {
66
73
throw InvalidArgumentException::invalidType ('"readPreference" option ' , $ options ['readPreference ' ], 'MongoDB\Driver\ReadPreference ' );
67
74
}
@@ -73,7 +80,7 @@ public function __construct(Manager $manager, $databaseName, array $options = []
73
80
$ this ->databaseName = (string ) $ databaseName ;
74
81
$ this ->options = $ options ;
75
82
76
- $ collectionOptions = array_intersect_key ($ options , ['readPreference ' => 1 , 'writeConcern ' => 1 ]);
83
+ $ collectionOptions = array_intersect_key ($ options , ['readConcern ' => 1 , ' readPreference ' => 1 , 'writeConcern ' => 1 ]);
77
84
78
85
$ this ->collectionWrapper = new CollectionWrapper ($ manager , $ databaseName , $ options ['bucketName ' ], $ collectionOptions );
79
86
$ this ->registerStreamWrapper ();
0 commit comments