@@ -271,17 +271,12 @@ public function command(array|object $command, array $options = []): CursorInter
271
271
* @see CreateCollection::__construct() for supported options
272
272
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#create-collection-helper
273
273
* @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/
274
- * @return array|object Command result document
275
274
* @throws UnsupportedException if options are not supported by the selected server
276
275
* @throws InvalidArgumentException for parameter/option parsing errors
277
276
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
278
277
*/
279
- public function createCollection (string $ collectionName , array $ options = []): array | object
278
+ public function createCollection (string $ collectionName , array $ options = []): void
280
279
{
281
- if (! isset ($ options ['typeMap ' ])) {
282
- $ options ['typeMap ' ] = $ this ->typeMap ;
283
- }
284
-
285
280
if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
286
281
$ options ['writeConcern ' ] = $ this ->writeConcern ;
287
282
}
@@ -296,7 +291,7 @@ public function createCollection(string $collectionName, array $options = []): a
296
291
297
292
$ server = select_server_for_write ($ this ->manager , $ options );
298
293
299
- return $ operation ->execute ($ server );
294
+ $ operation ->execute ($ server );
300
295
}
301
296
302
297
/**
@@ -314,17 +309,13 @@ public function createCollection(string $collectionName, array $options = []): a
314
309
* getPrevious() and getEncryptedFields() methods, respectively.
315
310
*
316
311
* @see CreateCollection::__construct() for supported options
317
- * @return array A tuple containing the command result document from creating the collection and the modified "encryptedFields" option
312
+ * @return array The modified "encryptedFields" option
318
313
* @throws InvalidArgumentException for parameter/option parsing errors
319
314
* @throws CreateEncryptedCollectionException for any errors creating data keys or creating the collection
320
315
* @throws UnsupportedException if Queryable Encryption is not supported by the selected server
321
316
*/
322
317
public function createEncryptedCollection (string $ collectionName , ClientEncryption $ clientEncryption , string $ kmsProvider , ?array $ masterKey , array $ options ): array
323
318
{
324
- if (! isset ($ options ['typeMap ' ])) {
325
- $ options ['typeMap ' ] = $ this ->typeMap ;
326
- }
327
-
328
319
if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
329
320
$ options ['writeConcern ' ] = $ this ->writeConcern ;
330
321
}
@@ -334,9 +325,11 @@ public function createEncryptedCollection(string $collectionName, ClientEncrypti
334
325
335
326
try {
336
327
$ operation ->createDataKeys ($ clientEncryption , $ kmsProvider , $ masterKey , $ encryptedFields );
337
- $ result = $ operation ->execute ($ server );
328
+ $ operation ->execute ($ server );
329
+
330
+ assert (is_array ($ encryptedFields ), '$encryptedFields is set ' );
338
331
339
- return [ $ result , $ encryptedFields] ;
332
+ return $ encryptedFields ;
340
333
} catch (Throwable $ e ) {
341
334
throw new CreateEncryptedCollectionException ($ e , $ encryptedFields ?? []);
342
335
}
@@ -347,17 +340,12 @@ public function createEncryptedCollection(string $collectionName, ClientEncrypti
347
340
*
348
341
* @see DropDatabase::__construct() for supported options
349
342
* @param array $options Additional options
350
- * @return array|object Command result document
351
343
* @throws UnsupportedException if options are unsupported on the selected server
352
344
* @throws InvalidArgumentException for parameter/option parsing errors
353
345
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
354
346
*/
355
- public function drop (array $ options = []): array | object
347
+ public function drop (array $ options = []): void
356
348
{
357
- if (! isset ($ options ['typeMap ' ])) {
358
- $ options ['typeMap ' ] = $ this ->typeMap ;
359
- }
360
-
361
349
$ server = select_server_for_write ($ this ->manager , $ options );
362
350
363
351
if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
@@ -366,7 +354,7 @@ public function drop(array $options = []): array|object
366
354
367
355
$ operation = new DropDatabase ($ this ->databaseName , $ options );
368
356
369
- return $ operation ->execute ($ server );
357
+ $ operation ->execute ($ server );
370
358
}
371
359
372
360
/**
@@ -375,17 +363,12 @@ public function drop(array $options = []): array|object
375
363
* @see DropCollection::__construct() for supported options
376
364
* @param string $collectionName Collection name
377
365
* @param array $options Additional options
378
- * @return array|object Command result document
379
366
* @throws UnsupportedException if options are unsupported on the selected server
380
367
* @throws InvalidArgumentException for parameter/option parsing errors
381
368
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
382
369
*/
383
- public function dropCollection (string $ collectionName , array $ options = []): array | object
370
+ public function dropCollection (string $ collectionName , array $ options = []): void
384
371
{
385
- if (! isset ($ options ['typeMap ' ])) {
386
- $ options ['typeMap ' ] = $ this ->typeMap ;
387
- }
388
-
389
372
$ server = select_server_for_write ($ this ->manager , $ options );
390
373
391
374
if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
@@ -401,7 +384,7 @@ public function dropCollection(string $collectionName, array $options = []): arr
401
384
? new DropEncryptedCollection ($ this ->databaseName , $ collectionName , $ options )
402
385
: new DropCollection ($ this ->databaseName , $ collectionName , $ options );
403
386
404
- return $ operation ->execute ($ server );
387
+ $ operation ->execute ($ server );
405
388
}
406
389
407
390
/**
@@ -497,12 +480,8 @@ public function listCollections(array $options = []): CollectionInfoIterator
497
480
* @throws InvalidArgumentException for parameter/option parsing errors
498
481
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
499
482
*/
500
- public function modifyCollection (string $ collectionName , array $ collectionOptions , array $ options = []): array | object
483
+ public function modifyCollection (string $ collectionName , array $ collectionOptions , array $ options = []): void
501
484
{
502
- if (! isset ($ options ['typeMap ' ])) {
503
- $ options ['typeMap ' ] = $ this ->typeMap ;
504
- }
505
-
506
485
$ server = select_server_for_write ($ this ->manager , $ options );
507
486
508
487
if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
@@ -511,7 +490,7 @@ public function modifyCollection(string $collectionName, array $collectionOption
511
490
512
491
$ operation = new ModifyCollection ($ this ->databaseName , $ collectionName , $ collectionOptions , $ options );
513
492
514
- return $ operation ->execute ($ server );
493
+ $ operation ->execute ($ server );
515
494
}
516
495
517
496
/**
@@ -522,21 +501,16 @@ public function modifyCollection(string $collectionName, array $collectionOption
522
501
* @param string $toCollectionName New name of the collection
523
502
* @param string|null $toDatabaseName New database name of the collection. Defaults to the original database.
524
503
* @param array $options Additional options
525
- * @return array|object Command result document
526
504
* @throws UnsupportedException if options are unsupported on the selected server
527
505
* @throws InvalidArgumentException for parameter/option parsing errors
528
506
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
529
507
*/
530
- public function renameCollection (string $ fromCollectionName , string $ toCollectionName , ?string $ toDatabaseName = null , array $ options = []): array | object
508
+ public function renameCollection (string $ fromCollectionName , string $ toCollectionName , ?string $ toDatabaseName = null , array $ options = []): void
531
509
{
532
510
if (! isset ($ toDatabaseName )) {
533
511
$ toDatabaseName = $ this ->databaseName ;
534
512
}
535
513
536
- if (! isset ($ options ['typeMap ' ])) {
537
- $ options ['typeMap ' ] = $ this ->typeMap ;
538
- }
539
-
540
514
$ server = select_server_for_write ($ this ->manager , $ options );
541
515
542
516
if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
@@ -545,7 +519,7 @@ public function renameCollection(string $fromCollectionName, string $toCollectio
545
519
546
520
$ operation = new RenameCollection ($ this ->databaseName , $ fromCollectionName , $ toDatabaseName , $ toCollectionName , $ options );
547
521
548
- return $ operation ->execute ($ server );
522
+ $ operation ->execute ($ server );
549
523
}
550
524
551
525
/**
0 commit comments