Skip to content

Releases: mongodb/mongoid

9.0.3

12 Nov 17:31
058e59e
Compare
Choose a tag to compare

Version 9.0.3 of the Mongoid ODM for MongoDB is now available.

Release Highlights

This patch release adds support for Ruby 3.3 and Rails 8 to Mongoid 9.0.

Documentation

Documentation is available at MongoDB.com.

Installation

You may install this version via RubyGems, with:

gem install --version 9.0.3 mongoid

What's Changed

Full Changelog: v9.0.2...v9.0.3

8.1.7

12 Nov 17:28
f3dbfa7
Compare
Choose a tag to compare

Version 8.1.7 of the Mongoid ODM for MongoDB is now available.

Release Highlights

This patch release adds support for Ruby 3.3 and Rails 8 to Mongoid 8.1.

Documentation

Documentation is available at MongoDB.com.

Installation

You may install this version via RubyGems, with:

gem install --version 8.1.7 mongoid

What's Changed

Full Changelog: v8.1.6...v8.1.7

9.0.2

20 Sep 12:14
fc09714
Compare
Choose a tag to compare

Version 9.0.2 of the Mongoid ODM for MongoDB is now available.

Release Highlights

This patch release adds support for Rails 7.2. It also adds support for custom polymorphic types, and includes bug fixes.

Documentation

Documentation is available at MongoDB.com.

Installation

You may install this version via RubyGems, with:

gem install --version 9.0.2 mongoid

What's Changed

New Contributors

Full Changelog: v9.0.1...v9.0.2

8.1.6

20 Sep 16:58
a549de2
Compare
Choose a tag to compare

Version 8.1.6 of the Mongoid ODM for MongoDB is now available.

Release Highlights

  • MONGOID-5806: Rails 7.2 support.
  • MONGOID-5769: Fix error with the $pull and $pop operators not being handled correctly by updateAll.
  • MONGOID-5789: Fix behavior when requesting an attribute with nil as the name. Previously raised a spurious exception, now returns an empty string.
  • MONGOID-5797: When using a projection on a model with an embeds_many relation, accessing the inverse (parent) relation was failing. This has been fixed.

Documentation

Documentation is available at MongoDB.com.

Installation

You may install this version via RubyGems, with:

gem install --version 8.1.6 mongoid

What's Changed

Full Changelog: v8.1.5...v8.1.6

9.0.1

29 Jul 19:50
15e2ba9
Compare
Choose a tag to compare

Version 9.0.1 of the Mongoid ODM for MongoDB is now available.

Release Highlights

  • MONGOID-5786: In accordance with Ruby's enumerable API, the #sum method now accepts an optional block. Thank you to Cristián Pérez for your contributions!
  • MONGOID-5688: Problematic recursive callstacks in cascading callbacks have been linearized using Ruby Fibers to prevent SystemStackErrors with greater numbers of embedded documents. Thank you to Adviti Mishra for your contributions!
  • MONGOID-5769: $pop and $pull are now mongoized the same way as #addToSet or $push to ensure update_all functions as intended. Thank you to John Maguir and Michael Deryugin for your contributions!
  • MONGOID-5789: querying an attribute with a nil name now returns an empty string, rather than raising an exception. Thank you to Dan Healy for your contribution!
  • MONGOID-5785: if you set Mongoid.allow_scopes_to_unset_default_scope = true, you can invoke (e.g.) unscoped in a named scope to reset the current scope. This is useful for overriding default scopes inside of a named scope. This option will default to true in Mongoid 10.
  • MONGOID-5791: If the parent document class is not loaded at the time of loading the embedded document class, a NameError used to be raised. This has been fixed.
  • MONGOID-5796: The docs previously present in the Mongoid repository have been moved to the docs-mongoid repository.

Documentation

Documentation is available at MongoDB.com.

Installation

You may install this version via RubyGems, with:

gem install --version 9.0.1 mongoid

What's Changed

New Contributors

Full Changelog: v9.0.0...v9.0.1

Mongoid 9.0

01 May 15:28
88f4b1a
Compare
Choose a tag to compare

Mongoid 9.0 is a new major update to the Mongoid ODM. It includes many bug fixes, updates, improvements, and new features.

Significant new features include the following:

  • You can now create and manage Atlas search indexes directly from Mongoid, by specifying your search index definitions directly on the relevant models. (MONGOID-5601)
  • You can now declare a transaction with a block, using syntax that should be familiar to Rails programmers. (You must still be using a MongoDB topology that supports transactions, like a replica-set or sharded topology.) Along with this new syntax, support has also been added for after_commit and after_rollback callbacks. (MONGOID-5530, MONGOID-5531 and MONGOID-5708)
  • Around callbacks on embedded documents are now disabled by default, for performance reasons. If a parent document has a large number (hundreds) of embedded documents, it is possible for the stack to be exhausted while processing "around" callbacks for those embedded documents. If you need around callbacks for your embedded documents, and you are confident that you will not have large numbers of embedded documents in a single parent, you can enable around callbacks with the Mongoid.around_embedded_document_callbacks configuration option. (MONGOID-5658)
  • A new serializer has been added to allow BSON::ObjectId instances to be serialized and deserialized by ActiveJob. (MONGOID-5611)
  • If you specify custom storage options when loading a model (e.g. overriding its collection name, database name, or the named client), you will not need to explicitly specify those same options when saving the model. The model will remember the storage options that were active when it was loaded. (MONGOID-5472)
  • Support for "sandbox mode" in the Rails console has been added. As long as you are using a supported topology (replica-set or sharded, for example), when you specify --sandbox when starting the Rails console, your console session will be wrapped in a transaction. (MONGOID-4901)
  • You can now enjoy Client-Side Field Level Encryption (CSFLE) in Mongoid with supported database server versions. Declare your CSFLE schemas in your documents, configure your encryption in mongoid.yml or config.rb, and generate new data keys via rake. (MONGOID-5585, MONGOID-5587, MONGOID-5589, MONGOID-5592, MONGOID-5613, MONGOID-5615.)

Many other changes are included as well, including the following:

  • Support for Rails 2.6 and Rails 5 have been dropped. (MONGOID-5574)
  • Support has been added for JRuby 9.4, and BSON 5. (MONGOID-5575, MONGOID-5739, RUBY-2846)
  • Added Mongoid.reconnect_clients in conjunction with improving documentation about working with forking webservers. (MONGOID-5758)
  • Saving a model in a session other than the one that loaded it will now result in a warning message (as this is generally considered a bug.) (MONGOID-5552)
  • Eager loading now works with embedded associations. These associations cannot actually be eager loaded, but this allows you to chain eager loading through embedded associations, for example with has-and-belongs-to-many associations. (MONGOID-5052)
  • For embedded associations, the default is now touch: true. This means that when you update an embedded document, its parent is automatically touched (or saved, with the timestamps updated) as well. (MONGOID-5016)
  • You can now prevent Mongoid from type-casting a given value in a query by wrapping it with Mongoid::RawValue. This makes it easier to deal with legacy data that does not conform to an expected type. (MONGOID-5408)
  • The Rails generator for Mongoid (rails g mongoid:config) now additionally generates a default config/initializers/mongoid.rb. (MONGOID-5439)
  • When calling #touch on a model, Mongoid now clears the 'changed' state of the model. Previously, #touch left the model in a 'changed' state, even though it had been persisted by the touch operation. (MONGOID-5504)
  • Mongoid's db:mongoid:create_indexes rake task was not always loading all models before creating the indexes, resulting in some missing indexes. This is now fixed. (MONGOID-5547)
  • Added support for $min, $max, and $mul operators (via set_min, set_max, and mul), as well as $setOnInsert when doing an upsert (via a new :set_on_insert option to #upsert). (MONGOID-5442)
  • A timezone configured in your app (via Time.zone=) will now be used when typecasting dates for time-valued fields. (MONGOID-5488)
  • Typecasting strings for numeric fields now correctly converts the strings into BigDecimal values. (MONGOID-5484)
  • Field aliases are now honored in index specifications. (MONGOID-5314)
  • Fixed an issue where an empty list in a HABTM association needed special handling (instead of blindly using an empty list with $in). (MONGOID-5164)
  • Attempting to call estimated_count when a default scope is active on a collection now raises a dedicated exception (Mongoid::Errors::InvalidEstimatedCountScoping) (MONGOID-4960)
  • Mongoid now raises Mongoid::Errors:AttributeNotLoaded when a program attempts to access a field that is defined on the model, but which was excluded by the query's projection. Previously, ActiveModel::MissingAttributeError was raised in this situation. (MONGOID-5467)
  • When assigning an array of Hashes to a field, the hashes are always converted to a BSON::Document. This makes the behavior consistent with how those fields are loaded from the database. (MONGOID-5410)

Additionally, a number of methods that were monkey-patched onto core modules have been deprecated, including the following:

Also, Criteria#for_js has been deprecated (MONGOID-5651), and Mongoid::QueryCache (which was previously deprecated) has been removed (MONGOID-5625).

8.1.5

28 Feb 19:29
ebc46d7
Compare
Choose a tag to compare

This patch release includes the following fixes:

MONGOID-5704: By default, associations (like belongs_to) are validated when a document is saved. However, Mongoid was aggressively loading persisted associations and validating them, which led to a significant performance regression in Mongoid 8+ (versus Mongoid 7.x). This patch fixes this regression by only validating associations that are (1) currently in-memory, and (2) either unpersisted or modified.

MONGOID-5709: has_and_belongs_to_many associations on embedded docments were broken, and attempting to use them would result in an "InvalidPath" exception. This patch release fixes that bug.

8.0.8

28 Feb 19:29
25a2ce3
Compare
Choose a tag to compare

This patch release includes the following fixes:

MONGOID-5704: By default, associations (like belongs_to) are validated when a document is saved. However, Mongoid was aggressively loading persisted associations and validating them, which led to a significant performance regression in Mongoid 8+ (versus Mongoid 7.x). This patch fixes this regression by only validating associations that are (1) currently in-memory, and (2) either unpersisted or modified.

MONGOID-5709: has_and_belongs_to_many associations on embedded docments were broken, and attempting to use them would result in an "InvalidPath" exception. This patch release fixes that bug.

8.1.4

22 Nov 10:58
56d051a
Compare
Choose a tag to compare

This is a patch release in 8.1.x series fixes the following issue:

We strongly recommend to upgrade to this version if you use 8.1.3.

This release also adds the following improvement:

8.1.3

23 Oct 15:56
51c41af
Compare
Choose a tag to compare

This is a patch release in 8.1.x series that adds support for Rails 7.1.

The following issues were fixed: