@@ -340,11 +340,17 @@ public function distinct($fieldName, $filter = [], array $options = [])
340340 /**
341341 * Drop this collection.
342342 *
343- * @return object Command result document
343+ * @see DropCollection::__construct() for supported options
344+ * @param array $options Additional options
345+ * @return array|object Command result document
344346 */
345- public function drop ()
347+ public function drop (array $ options = [] )
346348 {
347- $ operation = new DropCollection ($ this ->databaseName , $ this ->collectionName );
349+ if ( ! isset ($ options ['typeMap ' ])) {
350+ $ options ['typeMap ' ] = $ this ->typeMap ;
351+ }
352+
353+ $ operation = new DropCollection ($ this ->databaseName , $ this ->collectionName , $ options );
348354 $ server = $ this ->manager ->selectServer (new ReadPreference (ReadPreference::RP_PRIMARY ));
349355
350356 return $ operation ->execute ($ server );
@@ -353,19 +359,25 @@ public function drop()
353359 /**
354360 * Drop a single index in the collection.
355361 *
362+ * @see DropIndexes::__construct() for supported options
356363 * @param string $indexName Index name
357- * @return object Command result document
364+ * @param array $options Additional options
365+ * @return array|object Command result document
358366 * @throws InvalidArgumentException if $indexName is an empty string or "*"
359367 */
360- public function dropIndex ($ indexName )
368+ public function dropIndex ($ indexName, array $ options = [] )
361369 {
362370 $ indexName = (string ) $ indexName ;
363371
364372 if ($ indexName === '* ' ) {
365373 throw new InvalidArgumentException ('dropIndexes() must be used to drop multiple indexes ' );
366374 }
367375
368- $ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , $ indexName );
376+ if ( ! isset ($ options ['typeMap ' ])) {
377+ $ options ['typeMap ' ] = $ this ->typeMap ;
378+ }
379+
380+ $ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , $ indexName , $ options );
369381 $ server = $ this ->manager ->selectServer (new ReadPreference (ReadPreference::RP_PRIMARY ));
370382
371383 return $ operation ->execute ($ server );
@@ -374,11 +386,17 @@ public function dropIndex($indexName)
374386 /**
375387 * Drop all indexes in the collection.
376388 *
377- * @return object Command result document
389+ * @see DropIndexes::__construct() for supported options
390+ * @param array $options Additional options
391+ * @return array|object Command result document
378392 */
379- public function dropIndexes ()
393+ public function dropIndexes (array $ options = [] )
380394 {
381- $ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , '* ' );
395+ if ( ! isset ($ options ['typeMap ' ])) {
396+ $ options ['typeMap ' ] = $ this ->typeMap ;
397+ }
398+
399+ $ operation = new DropIndexes ($ this ->databaseName , $ this ->collectionName , '* ' , $ options );
382400 $ server = $ this ->manager ->selectServer (new ReadPreference (ReadPreference::RP_PRIMARY ));
383401
384402 return $ operation ->execute ($ server );
0 commit comments