锟斤拷锟斤拷锟斤拷志

锟皆憋拷锟斤拷展锟斤拷锟洁/锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟铰革拷锟铰★拷

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) 锟侥筹拷 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锟斤拷前锟侥版本锟斤,锟斤拷锟斤拷选锟筋都锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷牟锟斤拷锟斤拷锟街帮拷姹撅拷锟斤拷锟斤拷锟斤拷锟斤拷签锟斤拷锟斤拷锟斤拷锟斤拷锟侥o拷 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 锟斤拷值锟斤拷锟斤拷锟斤拷某锟斤拷址锟斤拷锟斤拷锟缴撅拷锟斤拷锟� 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 锟芥本锟叫o拷为锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 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 锟斤拷锟斤拷识一锟斤拷确锟较碉拷写锟诫。 锟斤拷锟节o拷锟斤拷锟斤拷锟酵拷锟� array('w' => 1) 锟斤拷锟矫o拷 MongoClient 默锟较碉拷锟斤拷为锟斤拷
 MongoCollection::removeoptions 锟斤拷锟斤拷锟斤拷锟劫斤拷锟斤拷 boolean 值锟斤拷锟斤拷锟斤拷 "justOne"锟斤拷 锟斤拷锟节o拷锟斤拷锟斤拷使锟斤拷 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 锟斤拷锟斤拷锟斤拷锟斤拷锟剿o拷锟斤拷锟皆碉拷锟斤拷 close 锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟解,锟节凤拷锟斤拷锟斤拷锟叫较高革拷锟斤拷时锟斤拷锟杰伙拷锟斤拷筛锟斤拷叩锟窖癸拷锟斤拷锟�
 MongoClient::__construct锟斤拷锟斤拷锟� "username" 锟斤拷 "password" 选锟筋。 锟狡筹拷锟斤拷 "persist" 选锟筋,锟斤拷锟叫碉拷锟斤拷锟接讹拷锟角持久的★拷锟斤拷锟皆撅拷锟杰癸拷使锟矫o拷锟斤拷锟角诧拷锟斤拷锟斤拷锟矫★拷 "persist" 锟角凤拷应锟斤拷锟角持撅拷锟斤拷锟接★拷锟斤拷锟斤拷锟斤拷锟斤拷耍锟斤拷锟斤拷踊锟斤拷浅志锟斤拷锟斤拷印锟� 锟街凤拷锟斤拷式锟斤拷值锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟接碉拷 ID锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 array("persist" => "foobar") 锟斤拷始锟斤拷锟斤拷 MongoClient 实锟斤拷锟结共锟斤拷一锟斤拷锟斤拷锟捷匡拷锟斤拷锟接o拷锟斤拷 array("persist" => "barbaz")锟斤拷始锟斤拷锟斤拷实锟斤拷锟斤拷使锟矫诧拷同锟斤拷锟斤拷锟捷匡拷锟斤拷锟接★拷 "replicaSet" 选锟斤拷锟斤拷锟斤拷支锟斤拷一锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟角诧拷锟斤拷值锟斤拷
 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" 选锟筋,锟斤拷锟斤拷锟斤拷锟酵改成帮拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷 array锟斤拷 锟斤拷锟津,猴拷之前一锟斤拷锟斤拷锟斤拷 boolean锟斤拷
 MongoCollection::remove锟斤拷锟斤拷锟� "safe" 选锟斤拷锟� integer 锟斤拷支锟街o拷之前只锟斤拷锟斤拷 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 锟斤拷锟斤拷锟角凤拷应锟斤拷锟角持久的★拷 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" 选锟筋并锟揭诧拷锟斤拷失锟斤拷锟剿o拷锟斤拷锟斤拷锟阶筹拷 MongoCursorException锟斤拷
 MongoCollection::updateChanged options parameter from boolean to array. Pre-1.0.1, the second parameter was an optional boolean value specifying an upsert.