������־

�Ա���չ���࣯���������������¸��¡�

MongoDB PHP Driver 1.5.0

It supports all new features for MongoDB 2.6, including:

  • Aggregate can now return a cursor
  • Aggregation pipelines can now be explained
  • Possible to set maxTimeMS for commands and queries
  • Transparent support for the new command-based MongoDB write API
  • New MongoWriteBatch classes (using the new MongoDB write API)
  • Support for MongoDB Enterprise features (e.g. Kerberos, LDAP, X509)
  • Option to tune acceptable server latency for secondary reads (secondaryAcceptableLatencyMS)

With this release, some driver functionality which was previously documented as deprecated will now formally raise deprecation notices. This includes:

  • Instantiating the Mongo class
  • Calling MongoCursor::slaveOkay()
  • "wtimeout" and "safe" options for MongoCollection write operations
  • Manipulating public properties on core classes (such as $collection->w)

Note:

No previously deprecated features have been removed.

Changes in behaviour:

  • Setting the mongo.native_long INI setting now raises an error on 32-bit platforms, and now defaults to true for 64-bit platforms.

MongoDB PHP Driver 1.4.0

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.

MongoDB PHP Driver 1.3.0

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.

Changes to existing methods

Following is a list of all improvements to existing methods since their inception.

VersionFunctionDescription
1.6.0MongoDB::getCollectionNamesChanged first parameter to be an array of options. Pre-1.6.0, the first parameter was a boolean indicating the "includeSystemCollections" option.
 MongoDB::listCollectionsChanged first parameter to be an array of options. Pre-1.6.0, the first parameter was a boolean indicating the "includeSystemCollections" option.
1.5.0log_cmd_deleteOnly available when connected to MongoDB 2.6.0+
 log_cmd_insertOnly available when connected to MongoDB 2.6.0+
 log_cmd_updateOnly available when connected to MongoDB 2.6.0+
 log_write_batchOnly available when connected to MongoDB 2.6.0+
 MongoBinData::__constructĬ��ֵ�� 2 (MongoBinData::BYTE_ARRAY) �ij� 0 (MongoBinData::GENERIC)��
 MongoCollection::aggregateAdded optional options argument
 MongoCollection::batchInsertAdded 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::ensureIndexRenamed 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::findOneAdded optional options argument.
 MongoCollection::groupAdded "maxTimeMS" option.
 MongoCollection::save���� "wTimeoutMS" ѡ�������� "wtimeout"�� ʹ�� "wtimeout" ʱ���� E_DEPRECATED ���� ���� "socketTimeoutMS" ѡ�������� "timeout"�� ʹ�� "timeout" ʱ���� E_DEPRECATED ���� ʹ�� "safe" ʱ���� E_DEPRECATED ����
 MongoCollection::toIndexStringThis method has been deprecated.
 MongoCollection::updateAdded 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::slaveOkayThis method has been deprecated in favour of MongoCursor::setReadPreference and .
1.4.5MongoCursor::batchSizeBefore 1.4.5, this method would throw an MongoCursorException if the cursor had already started iterating.
1.4.0MongoCursor::hintThe index argument now supports index names as string values. In versions before 1.4.0, only array or object values were accepted.
 MongoCursor::setFlagSupport for flag 3 (OPLOG_REPLAY) is added. Versions before 1.4.0 would throw a warning saying that the flag is unsupported.
 MongoDB::createCollection1.4.0��ǰ�İ汾�����ѡ�����������IJ�����֮ǰ�汾���������ǩ���������ģ� public MongoCollectionMongoDB::createCollection stringname boolcappedFALSE intsize0 intmax0 ���������������ڰ汾�� options ������ͬ��
 MongoId::__construct������Ч�ַ����׳��쳣
1.3.4MongoClient::__construct����� "connectTimeoutMS" �� "socketTimeoutMS" ѡ�
 MongoCollection::batchInsertAdded "wtimeout" option.
 MongoCollection::ensureIndexAdded "wtimeout" option.
 MongoCollection::updateAdded "wtimeout" option.
1.3.3MongoClient::getReadPreference���ص�ֵ�޸�Ϊ���� MongoClient::setReadPreference�� type ��ֵ������ij��ַ�����ɾ���� type_string������ tagsets �����Լ�ֵ��ʾ�ı�ǩ������ð�ŷָ����ַ�����
 MongoCollection::getReadPreferenceThe 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::getReadPreferenceThe 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.0MongoClient::close�� 1.3.0 �汾�У�Ϊ������������ connection ������ �ڴ�֮ǰ��ֱ��д�����ӲŻᱻ��������رա�
 MongoClient::__construct����� "readPreference"�� "readPreferenceTags"��"w" �� "wTimeout" ѡ�
 MongoCollection::batchInsertAdded "w" option.
 MongoCollection::ensureIndexAdded "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::insertoptions �������ٽ��� boolean ����ʶһ��ȷ�ϵ�д�롣 ���ڣ������ͨ�� array('w' => 1) ���ã� MongoClient Ĭ�ϵ���Ϊ��
 MongoCollection::removeoptions �������ٽ��� boolean ֵ������ "justOne"�� ���ڣ�����ʹ�� array('justOne' => true) ��Ϊ�����
 MongoCollection::updateAdded "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::listCollectionsAdded the includeSystemCollections parameter.
 MongoGridFSCursor::keyThe document's _id is returned as a string value, since the key should be unique. Pre-1.3.0, filename was returned.
1.2.11Mongo::getPoolSizeEmits E_DEPRECATED when used.
 Mongo::getSlaveEmits E_DEPRECATED when used.
 Mongo::getSlaveOkayEmits E_DEPRECATED when used.
 Mongo::poolDebugEmits E_DEPRECATED when used.
 Mongo::setSlaveOkayEmits E_DEPRECATED when used.
 Mongo::switchSlaveEmits E_DEPRECATED when used.
 MongoBinData::__constructû��ʹ�õڶ�������ʱ���� E_DEPRECATED�� type ��Ĭ��ֵ�ڽ��ڵĹ�������ܻ�ı䡣
 MongoCollection::ensureIndexEmits E_DEPRECATED when options is scalar.
 MongoCollection::getSlaveOkayEmits E_DEPRECATED when used.
 MongoCollection::groupEmits E_DEPRECATED when options is scalar.
 MongoCollection::remove�� options �� scalar ʱ����һ�� E_DEPRECATED ���档
 MongoCollection::setSlaveOkayEmits E_DEPRECATED when used.
 MongoCollection::updateEmits E_DEPRECATED when options is scalar.
 MongoCursor::doQueryEmits E_DEPRECATED when used.
 MongoDB::authenticateʹ��ʱ���� E_DEPRECATED�� �뽫��֤ϸ�ڴ��뵽��������
 MongoDB::forceErrorEmits E_DEPRECATED when used.
 MongoDB::getSlaveOkayEmits E_DEPRECATED when used.
 MongoDB::prevErrorEmits E_DEPRECATED when used.
 MongoDB::resetErrorEmits E_DEPRECATED when used.
 MongoDB::setSlaveOkayEmits E_DEPRECATED when used.
 MongoPool::getSizeEmits E_DEPRECATED when used.
 MongoPool::infoEmits E_DEPRECATED when used.
 MongoPool::setSizeEmits E_DEPRECATED when used.
1.2.10MongoClient::getHosts�ԷǼ�Ⱥ��֧�֡� ���ص�����Ԫ������Ҳ������ hostname �� port��
1.2.7MongoCollection::batchInsertAdded "continueOnError" option.
1.2.5MongoGridFS::storeUploadChanged second parameter to an array of metadata. Pre-1.2.5, the second parameter was an optional string overriding the filename.
1.2.0MongoClient::close�ڰ汾 1.2.0 ֮ǰ���������Ĭ�ϲ���ʹ�ó־����ӣ��������ӻ������������ʱ�رա� ���ڰ汾 1.2.0 ���������ˣ����Ե��� close ����һ�������⣬�ڷ������нϸ߸���ʱ���ܻ���ɸ��ߵ�ѹ����
 MongoClient::__construct����� "username" �� "password" ѡ� �Ƴ��� "persist" ѡ����е����Ӷ��dz־õġ����Ծ��ܹ�ʹ�ã����Dz������á� "persist" �Ƿ�Ӧ���dz־����ӡ���������ˣ����ӻ��dz־����ӡ� �ַ���ʽ��ֵ�����������ӵ� ID������������ array("persist" => "foobar") ��ʼ���� MongoClient ʵ���Ṳ��һ�����ݿ����ӣ��� array("persist" => "barbaz")��ʼ����ʵ����ʹ�ò�ͬ�����ݿ����ӡ� "replicaSet" ѡ������֧��һ���ַ����������Dz���ֵ��
 MongoCollection::ensureIndexAdded "timeout" option.
 MongoCollection::insert������ "timeout" ѡ�
 MongoCollection::remove��� "timeout" ѡ�
 MongoCollection::save���� "timeout" ѡ�
 MongoCollection::updateAdded "timeout" option.
 MongoDB::command��� options ��������һ��ѡ��:"timeout"��
1.1.0MongoCursor::infoAdded 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.11MongoCollection::ensureIndexThe "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��������� "safe"������ "not master" ����ʱ�Ͽ����ӡ�
 MongoCollection::remove�������� "safe" ֮�󣬽��ڳ��� "not master" ����ʱ�Ͽ����ӡ�
 MongoCollection::save���� "safe" ʱ�������� "not master" ����ʱ�����Ͽ����ӡ�
 MongoCollection::updateDisconnects on "not master" errors if "safe" is set.
1.0.10MongoCursor::infoAdded started_iterating field, a boolean indicating if cursor is pre- or post-query.
1.0.9MongoClient::__construct����� "replicaSet" ѡ�
 MongoCollection::batchInsertAdded ability to pass integers to the "safe" option, which previously only accepted booleans. Added "fsync" option.
 MongoCollection::insert"safe" ѡ����� integer ֵ��֮ǰֻ���� boolean ֵ�� ���� "fsync" ѡ� ��������� "safe" ѡ��������͸ijɰ���������Ϣ�� array�� ���򣬺�֮ǰһ������ boolean��
 MongoCollection::remove����� "safe" ѡ��� integer ��֧�֣�֮ǰֻ���� boolean ֵ�� ����� "fsync" ѡ� ��ʹ���� "safe" ѡ��ʱ���᷵�ذ���������Ϣ�����顣 �����֮ǰһ������һ�� boolean��
 MongoCollection::save���� "fsync" ѡ�
 MongoCollection::updateAdded 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.7MongoCollection::count����� limit �� skip ������
1.0.5MongoCollection::batchInsertAdded options parameter.
 MongoCollection::ensureIndexAdded the "name" option to override index name creation.
 MongoCollection::insert�޸ĵڶ�������Ϊѡ�����顣�� 1.0.5 ֮ǰ���ڶ��������� boolean��ָʾ "safe" ѡ�
 MongoCollection::remove�޸ĵڶ�������Ϊѡ��� array���� 1.0.5 ֮ǰ���ڶ���ѡ���� boolean ֵ�� ������ "safe" ѡ�
 MongoCollection::save���� options ������
 MongoCollection::updateAdded "safe" option.
1.0.2MongoClient::__construct�޸Ĺ�����֧��ѡ�����顣�� 1.0.2 ֮ǰ���������������²����� server ���������� connect ��ѡ�� boolean ����ָ���˹������Ƿ�Ӧ���ڷ���ǰ���ӵ����ݿ⡣Ĭ��Ϊ TRUE�� persistent �����Ƿ�Ӧ���dz־õġ� paired �����Ƿ�Ӧ��Ϊ paired ģʽ��
 MongoCollection::ensureIndexChanged options parameter from boolean to array. Pre-1.0.2, the second parameter was an optional boolean value specifying a unique index.
1.0.1MongoCollection::insert��������� "safe" ѡ��Ҳ���ʧ���ˣ������׳� MongoCursorException��
 MongoCollection::updateChanged options parameter from boolean to array. Pre-1.0.1, the second parameter was an optional boolean value specifying an upsert.