Следующие изменения были произведены с классами/функциями/методами данного расширения.
It supports all new features for MongoDB 2.6, including:
With this release, some driver functionality which was previously documented as deprecated will now formally raise deprecation notices. This includes:
Замечание:
No previously deprecated features have been removed.
Changes in behaviour:
The 1.4 series introduced fundemental changes in how connections are created to the MongoDB servers. The driver now utilizes PHP native streams, so all normal PHP stream options apply. Furthermore, an experimental Stream Context Support was added.
The 1.4.x series also added support for MongoDB 2.4.x.
The most important improvements however deal with the handling of replica sets, especially nodes that timeout and nodes that are unreachable for various reasons. Besides the improvements to replica set handling, this release addresses issues with read preferences through mongos nodes. It also adds support for SSL enabled connections as well as journal and fsync connection string options.
The 1.3 series introduced several major changes to the extension such as completely rewritten connection handling (and removal of the pooling mechanism), support for ReadPreferences and change the default WriteConcerns to be acknowledged by introducing a new class MongoClient which serves as a replacement class for the now deprecated Mongo class.
The driver now also supports connecting to multiple mongos instances (the Mongo Shard router) for loadbalancing.
Other enhancements include improved logging for easier connection handling debugging with MongoLog and support for the » Aggregation Framework via the MongoCollection::aggregate() method.
Following is a list of all improvements to existing methods since their inception.
Version | Function | Description |
---|---|---|
1.7.0 | MongoDB::execute | This method has been deprecated as a result of the underlaying eval command being deprecated in MongoDB 3.0+. |
1.6.0 | MongoCollection::count | Теперь второй параметр options является массивом опций. limit и skip в качестве второго и третьего параметра, соотвественно, являются устаревшими |
MongoDB::getCollectionNames | Changed first parameter to be an array of options. Pre-1.6.0, the first parameter was a boolean indicating the "includeSystemCollections" option. | |
MongoDB::listCollections | Changed first parameter to be an array of options. Pre-1.6.0, the first parameter was a boolean indicating the "includeSystemCollections" option. | |
1.5.0 | log_cmd_delete | Only available when connected to MongoDB 2.6.0+ |
log_cmd_insert | Only available when connected to MongoDB 2.6.0+ | |
log_cmd_update | Only available when connected to MongoDB 2.6.0+ | |
log_write_batch | Only available when connected to MongoDB 2.6.0+ | |
MongoBinData::__construct | The default changed from 2 (MongoBinData::BYTE_ARRAY) to 0 (MongoBinData::GENERIC). | |
MongoClient::__construct | Added "authSource". | |
MongoClient::__construct | Added "authMechanism", "gssapiServiceName", and "secondaryAcceptableLatencyMS". | |
MongoCollection::aggregate | Added optional options argument | |
MongoCollection::batchInsert | Added the "wTimeoutMS" option, which replaces "wtimeout". Emits E_DEPRECATED when "wtimeout" is used. Added the "socketTimeoutMS" option, which replaces "timeout". Emits E_DEPRECATED when "timeout" is used. Emits E_DEPRECATED when "safe" is used. | |
MongoCollection::ensureIndex | Renamed the "wtimeout" option to "wTimeoutMS". Emits E_DEPRECATED when "wtimeout" is used. Renamed the "timeout" option to "socketTimeoutMS". Emits E_DEPRECATED when "timeout" is used. Emits E_DEPRECATED when "safe" is used. | |
MongoCollection::findOne | Added optional options argument. | |
MongoCollection::group | Added "maxTimeMS" option. | |
MongoCollection::insert | Added the "wTimeoutMS" option, which replaces "wtimeout". Emits E_DEPRECATED when "wtimeout" is used. Added the "socketTimeoutMS" option, which replaces "timeout". Emits E_DEPRECATED when "timeout" is used. Emits E_DEPRECATED when "safe" is used. | |
MongoCollection::remove | Добавлена опция "wTimeoutMS" в замен устаревшей "wtimeout". Ошибка уровня E_DEPRECATED будет вызвана в случае использования "wtimeout". Добавлена опция "socketTimeoutMS" в замен устаревшей "timeout". Ошибка уровня E_DEPRECATED будет вызвана в случае использования "timeout". Ошибка уровня E_DEPRECATED будет вызвана в случае использования "safe". | |
MongoCollection::save | Added "wTimeoutMS" option, which replaces "wtimeout". Emits E_DEPRECATED when "wtimeout" is used. Added "socketTimeoutMS" option, which replaces "timeout". Emits E_DEPRECATED when "timeout" is used. Emits E_DEPRECATED when "safe" is used. | |
MongoCollection::toIndexString | This method has been deprecated. | |
MongoCollection::update | Added the "wTimeoutMS" option, which replaces "wtimeout". Emits E_DEPRECATED when "wtimeout" is used. Added the "socketTimeoutMS" option, which replaces "timeout". Emits E_DEPRECATED when "timeout" is used. Emits E_DEPRECATED when "safe" is used. | |
MongoCursor::slaveOkay | This method has been deprecated in favour of MongoCursor::setReadPreference and . | |
MongoDB::command | Renamed the "timeout" option to "socketTimeoutMS". Emits E_DEPRECATED when "timeout" is used. Added hash by-reference parameter. | |
1.4.5 | MongoCursor::batchSize | Before 1.4.5, this method would throw an MongoCursorException if the cursor had already started iterating. |
1.4.0 | MongoClient::__construct | Added "ssl" option and support for connecting over SSL. Added "wTimeoutMS" option, which replaces "wTimeout". Emits E_DEPRECATED when "slaveOkay" or "timeout" is used. |
MongoCursor::hint | The index argument now supports index names as string values. In versions before 1.4.0, only array or object values were accepted. | |
MongoCursor::setFlag | Support for flag 3 (OPLOG_REPLAY) is added. Versions before 1.4.0 would throw a warning saying that the flag is unsupported. | |
MongoDB::createCollection | In versions before 1.4.0, the options were all arguments to the method. The function synopsis in those older versions is: public MongoCollectionMongoDB::createCollection stringname boolcappedFALSE intsize0 intmax0 The meaning of the options is the same as described under the options argument above. | |
MongoId::__construct | An exception is thrown when passed invalid string | |
1.3.4 | MongoClient::__construct | Added "connectTimeoutMS" and "socketTimeoutMS" options. |
MongoCollection::batchInsert | Added "wtimeout" option. | |
MongoCollection::ensureIndex | Added "wtimeout" option. | |
MongoCollection::insert | Added "wtimeout" option. | |
MongoCollection::remove | Добавлена опция "wtimeout". | |
MongoCollection::update | Added "wtimeout" option. | |
1.3.3 | MongoClient::getReadPreference | The return value has changed to be consistent with MongoClient::setReadPreference. The type value was changed from a number to a string, type_string was removed, and tagsets now expresses tags as key/value pairs instead of colon-delimited strings. |
MongoCollection::getReadPreference | The return value has changed to be consistent with MongoCollection::setReadPreference. The type value was changed from a number to a string, type_string was removed, and tagsets now expresses tags as key/value pairs instead of colon-delimited strings. | |
MongoDB::getReadPreference | The return value has changed to be consistent with MongoDB::setReadPreference. The type value was changed from a number to a string, type_string was removed, and tagsets now expresses tags as key/value pairs instead of colon-delimited strings. | |
1.3.0 | MongoClient::close | The connection parameter to this function was added in 1.3.0. Before that, only the write connection would be closed by this method. |
MongoClient::__construct | Added "readPreference", "readPreferenceTags", "w", and "wTimeout" options. | |
MongoCollection::batchInsert | Added "w" option. | |
MongoCollection::ensureIndex | Added "w" option. The options parameter no longer accepts a boolean to signify a unique index. Instead, this now has to be done with array('unique' => true). | |
MongoCollection::insert | Added "w" option. The options parameter no longer accepts a boolean to signify an acknowledged write. Instead, this now has to be done with array('w' => 1) (the default behaviour of MongoClient). | |
MongoCollection::remove | Добавлена опция "w". Параметр options больше не принимает логические значения для определения поведения как "justOne". Вместо этого необходимо использовать array('justOne' => true). | |
MongoCollection::update | Added "w" option. The options parameter no longer accepts a boolean to signify an upsert. Instead, this now has to be done with array('upsert' => true). | |
MongoDB::listCollections | Added the includeSystemCollections parameter. | |
MongoGridFSCursor::key | The document's _id is returned as a string value, since the key should be unique. Pre-1.3.0, filename was returned. | |
1.2.11 | Mongo::getPoolSize | Emits E_DEPRECATED when used. |
Mongo::getSlave | Emits E_DEPRECATED when used. | |
Mongo::getSlaveOkay | Emits E_DEPRECATED when used. | |
Mongo::poolDebug | Emits E_DEPRECATED when used. | |
Mongo::setSlaveOkay | Emits E_DEPRECATED when used. | |
Mongo::switchSlave | Emits E_DEPRECATED when used. | |
MongoBinData::__construct | Emits E_DEPRECATED when the second argument is not used. The default value for type may change in the near future. | |
MongoCollection::ensureIndex | Emits E_DEPRECATED when options is scalar. | |
MongoCollection::getSlaveOkay | Emits E_DEPRECATED when used. | |
MongoCollection::group | Emits E_DEPRECATED when options is scalar. | |
MongoCollection::remove | Ошибка уровня E_DEPRECATED если options скалярного типа. | |
MongoCollection::setSlaveOkay | Emits E_DEPRECATED when used. | |
MongoCollection::update | Emits E_DEPRECATED when options is scalar. | |
MongoCursor::doQuery | Emits E_DEPRECATED when used. | |
MongoDB::authenticate | Emits E_DEPRECATED when used. Please pass in the authentication details to the constructor. | |
MongoDB::forceError | Emits E_DEPRECATED when used. | |
MongoDB::getSlaveOkay | Emits E_DEPRECATED when used. | |
MongoDB::prevError | Emits E_DEPRECATED when used. | |
MongoDB::resetError | Emits E_DEPRECATED when used. | |
MongoDB::setSlaveOkay | Emits E_DEPRECATED when used. | |
MongoPool::getSize | Emits E_DEPRECATED when used. | |
MongoPool::info | Emits E_DEPRECATED when used. | |
MongoPool::setSize | Emits E_DEPRECATED when used. | |
1.2.10 | MongoClient::getHosts | Support for non-replicasets was added. The returned array elements now also include the hostname and port. |
1.2.7 | MongoCollection::batchInsert | Added "continueOnError" option. |
1.2.5 | MongoGridFS::storeUpload | Changed second parameter to an array of metadata. Pre-1.2.5, the second parameter was an optional string overriding the filename. |
1.2.0 | MongoClient::close | Before version 1.2.0 the driver would not use persistent connections by default, and all connections would be closed as soon as a MongoDB connection went out if scope. Since version 1.2.0 this is no longer the case and it is a bad idea to call close as you might end up overloading the server with connections under high load. |
MongoClient::__construct | Added "username" and "password" options. Removed "persist" option, as all connections are now persistent. It can still be used, but it doesn't affect anything. "persist" If the connection should be persistent. If set, the connection will be persistent. The string representation of the value is used as an ID for the connection, so two instances of MongoClient that are initialized with array("persist" => "foobar") will share the same database connection, whereas an instance initialized with array("persist" => "barbaz") will use a different database connection. The "replicaSet" option now takes a string, not a boolean. | |
MongoCollection::ensureIndex | Added "timeout" option. | |
MongoCollection::insert | Added "timeout" option. | |
MongoCollection::remove | Добавлена опция "timeout". | |
MongoCollection::save | Added "timeout" option. | |
MongoCollection::update | Added "timeout" option. | |
MongoDB::command | Added options parameter with a single option: "timeout". | |
1.1.0 | MongoCursor::info | Added a number of other fields, including id (the cursor id), at (the driver's counter of which document is current), numReturned (the number returned by the server in the current batch), and server (which server the query was sent to—useful in conjunction with . |
1.0.11 | MongoCollection::ensureIndex | The "safe" option will trigger a primary failover, if necessary. MongoException will be thrown if the index name (either generated or set) is longer than 128 bytes. |
MongoCollection::insert | Disconnects on "not master" errors if "safe" is set. | |
MongoCollection::remove | Ошибки сброса соединения на "не мастере" если установлена "safe". | |
MongoCollection::save | Disconnects on "not master" errors if "safe" is set. | |
MongoCollection::update | Disconnects on "not master" errors if "safe" is set. | |
1.0.10 | MongoCursor::info | Added started_iterating field, a boolean indicating if cursor is pre- or post-query. |
1.0.9 | MongoClient::__construct | Added "replicaSet" option. |
MongoCollection::batchInsert | Added ability to pass integers to the "safe" option, which previously only accepted booleans. Added "fsync" option. | |
MongoCollection::insert | Added ability to pass integers to the "safe" option, which previously only accepted booleans. Added "fsync" option. The return type was changed to be an array containing error information if the "safe" option is used. Otherwise, a boolean is returned as before. | |
MongoCollection::remove | Добавлена возможность передавать целые числа в опцию "safe", которая ранее принимала только логические значения. Добавлена опция "fsync". Тип возвращаемого значения изменен на массив, содержащий информацию об ошибке если установлена опция "safe". В протовном случае, как и раньше, возвращается логическое значения. | |
MongoCollection::save | Added "fsync" option. | |
MongoCollection::update | Added ability to pass integers to the "safe" option, which previously only accepted booleans. Added "fsync" option. The return type was changed to be an array containing error information if the "safe" option is used. Otherwise, a boolean is returned as before. | |
1.0.7 | MongoCollection::count | Добавлены limit и skip как второй и третий параметр соотвественно |
1.0.5 | MongoCollection::batchInsert | Added options parameter. |
MongoCollection::ensureIndex | Added the "name" option to override index name creation. | |
MongoCollection::remove | Второй парамент теперь принимает массив опция. До версии 1.0.5 второй параметр принимал логическое значение, устанавливавшее опцию "safe". | |
MongoCollection::save | Added options parameter. | |
MongoCollection::update | Added "safe" option. | |
1.0.2 | MongoClient::__construct | Changed constructor to take an array of options. Pre-1.0.2, the constructor took the following parameters: server The server name. connect Optional boolean parameter specifying if the constructor should connect to the database before returning. Defaults to TRUE. persistent If the connection should be persistent. paired If the connection should be paired. |
MongoCollection::ensureIndex | Changed options parameter from boolean to array. Pre-1.0.2, the second parameter was an optional boolean value specifying a unique index. | |
MongoCollection::insert | Changed second parameter to be an array of options. Pre-1.0.2, the second parameter was a boolean indicating the "safe" option. | |
1.0.1 | MongoCollection::insert | Throw a MongoCursorException if the "safe" option is set and the insert fails. |
MongoCollection::update | Changed options parameter from boolean to array. Pre-1.0.1, the second parameter was an optional boolean value specifying an upsert. |