The Ruby driver team is please to announce the release of version 2.18.0. This feature release of the Ruby driver supports MongoDB version 6.0. It includes the following new features:
- Added support for queryable encryption.
- Added support for Azure Key Vault, Google Cloud Key Management, and any KMIP compliant Key Management System to be used as master key storage for client side encryption.
- It is now possible to provide the path to a schema map file instead of the entire schema map as an object.
- The driver now implements the feature flag mechanism for incompatible changes and bug fixes. Changes gated behind feature flags for 2.18 are passing view filter and options to aggregate and validation of correct usage of update vs replace methods, as described below.
- Added the validate_update_replace feature flag which validates the parameters to update and replace operations. If this flag is turned on, an error will be raised on an invalid update or replacement document.
- Added the broken_view_options feature flag which allows the view options to be correctly propagated to the aggregate, count, count_documents, distinct, and estimated_document_count mehods. When this flag is switched on, the view options will be ignored in those methods.
- The driver now permits inserting documents with dollar-prefixed and dotted keys.
- CRUD methods, methods for listing databases, collection, and indexes management methods now support a new option :comment. This option enables users to specify an arbitrary comment to help trace the operation through the database profiler, currentOp and logs.
- The estimated_document_count method is now using the count server command instead of $collStats` aggregation pipeline stage, to support operation on views. Applications using the Stable API should upgrade to server versions 5.0.8 (if using MongoDB 5.0) or 5.3.2 (if using MongoDB 5.1/5.2/5.3) or newer to use the count command when API strict is enabled, or avoid setting api_strict: true when constructing Mongo::Client instances with server versions 5.0.0-5.0.7 and 5.1.0-5.3.1.
- The DBRef class has been moved to bson-ruby. For backwards compatibility, BSON::DBRef is aliased as Mongo::DBRef. The BSON::DBRef class derives from BSON::Document, unlike the legacy Mongo::DBRef which derived from Object. BSON::DBRef retains all attributes passed into its constructor, unlike Mongo::DBRef which only allowed $ref, $id, and $db. BSON::DBRef also reorders the fields if necessary to place $ref, $id, and $db first, in that order, as required by the MongoDB server.
- BulkWrite::Result class now has the acknowledged? attribute.
- Providing an empty array of operations to the bulk write is now an error.
- BSON serialization performance has been improved.
- ActiveJob middleware was added to the query cache.
- :authorized_collections options is recognized when listing collections.
- :wildcard_projection option was added to the allowed index specification.
- Added :srv_max_hosts/srvMaxHosts Ruby and URI options to limit how many mongos routers the driver will establish connections to.
- Custom SRV service names are now supported with the :srv_service_name Ruby option and the srvServiceName URI option.
- When 0 is given as the max connection pool size, it is now interpreted to mean no limit.
- The default maximum connection pool size has been increased to 20 from 5.
The following minor improvements were made:
The following issues were addressed:
- RUBY-2972 Calling find_one_and_* methods with write_concern 0 causes an error
- RUBY-2923 Slow spawn of mongocryptd
- RUBY-2961 Zero & negative limits not emulated correctly by QueryCache
- RUBY-1869 watch methods unaffected by :max_await_time_ms
- RUBY-2869 ruby 3.1.0: finalizer can’t synchronize using mutexes
- RUBY-2990 Terminate push monitor when it fails