- Classes in the namespace
MongoDB\Operation\arefinal. - All methods in interfaces and classes now define a return type.
- The
MongoDB\ChangeStream::CURSOR_NOT_FOUNDconstant is now private. - The
MongoDB\Operation\Watch::FULL_DOCUMENT_DEFAULTconstant has been removed. - The
getNamespaceandisGeoHaystackmethods have been removed from theMongoDB\Model\IndexInfoclass. - The
maxScan,modifiers,oplogReplay, andsnapshotoptions forfindandfindOneoperations have been removed. - The
MongoDB\Collection::mapReducemethod has been removed. Use aggregation pipeline instead. - The following classes and interfaces have been removed without replacement:
MongoDB\MapReduceResultMongoDB\Model\CollectionInfoCommandIteratorMongoDB\Model\CollectionInfoIteratorMongoDB\Model\DatabaseInfoIteratorMongoDB\Model\DatabaseInfoLegacyIteratorMongoDB\Model\IndexInfoIteratorMongoDB\Model\IndexInfoIteratorIteratorMongoDB\Operation\Executable
- The
flagsandautoIndexIdoptions forMongoDB\Database::createCollection()have been removed. Additionally, theUSE_POWER_OF_2_SIZESandNO_PADDINGconstants inMongoDB\Operation\CreateCollectionhave been removed.
The following operations no longer return the raw command result. The return
type changed to void. In case of an error, an exception is thrown.
MongoDB\Client:dropDatabaseMongoDB\Collection:drop,dropIndex,dropIndexes,dropSearchIndex,renameMongoDB\Database:createCollection,drop,dropCollection,renameCollectionMongoDB\Database::createEncryptedCollection()returns the list of encrypted fields
If you still need to access the raw command result, you can use a
CommandSubscriber.
-
The
md5is no longer calculated when a file is uploaded to GridFS. Applications that require a file digest should implement it outside GridFS and store in metadata.$hash = hash_file('sha256', $filename); $bucket->openUploadStream($fileId, ['metadata' => ['hash' => $hash]]);
-
The fields
contentTypeandaliasesare no longer stored in thefilescollection. Applications that require this information should store it in metadata.Before:
$bucket->openUploadStream($fileId, ['contentType' => 'image/png']);
After:
$bucket->openUploadStream($fileId, ['metadata' => ['contentType' => 'image/png']]);
The following methods have been removed from the
MongoDB\Exception\UnsupportedException class:
allowDiskUseNotSupportedarrayFiltersNotSupportedcollationNotSupportedexplainNotSupportedreadConcernNotSupportedwriteConcernNotSupported
The remaining methods have been marked as internal and may be removed in a future minor version. Only the class itself is covered by the BC promise.