Why
mongoid 8.1.3 declares activemodel >= 5.1, < 7.2. It is a hard resolution blocker for Rails 7.2 — bundle update rails cannot work around it.
Mongoid 9.1 declares activemodel >= 5.1, < 8.2, so it supports Rails 7.1 and 8.1. That means this can land on Rails 7.1, before the framework bump, where a failure is unambiguous. Verified: rails 7.1.6 + mongoid 9.1.0 resolves cleanly.
Why this one is on its own
Highest-risk change in the sequence. Major ODM version, and it pulls mongo 2.20 -> 2.25 and bson 4.15 -> 5.2 (a major bump). 15 models include Mongoid::Document.
Scope / things to work through
- Set
Mongoid.load_defaults 9.0 in config/initializers/mongoid.rb (currently 8.1). Consider landing the gem bump on 8.1 first and flipping defaults in a follow-up commit.
- Verify the
BSON::ObjectId monkey patch in that initializer (it aliases to_json/as_json to to_s) still behaves under bson 5. This one patch shapes every ID in every API response. Mongoid 9 also ships an ActiveJob serializer for BSON::ObjectId which may make part of it redundant.
Mongoid::Document.send(:include, ActiveModel::SerializerSupport) and the Mongoid::Criteria.delegate(:active_model_serializer, ...) line in the same initializer are AMS 0.9 glue — exercise the controller specs specifically.
- Mongoid 9 defaults embedded associations to
touch: true. Checked: this app has zero embeds_many/embeds_one — Checkin uses has_many with class_name: "Checkin::Treatment" etc. So the new default does not apply.
symmetric-encryption registers Mongoid::Fields.option :encrypted, which is the linchpin of the Postgres<->Mongo encrypted_user_id link. Checked: Mongoid 9's CSFLE uses the encrypt: option, not encrypted:, so there is no collision. Still worth a smoke test round-tripping a Checkin through encrypted_user_id back to a Postgres User.
- Confirm MongoDB 4.4.9 (docker-compose and the
supercharge/mongodb-github-action pin in CI) is still supported by mongo driver 2.25. If not, bumping the server image should land first.
Sibling gems to re-verify: cancancan-mongoid, kaminari-mongoid, database_cleaner-mongoid, mongoid-rspec.
Acceptance criteria
Blocked by
#880 (upgrade prep). Blocks #883.
Part of the Ruby + Rails upgrade sequence. Ruby 3.2 reached end of life on 2026-04-01 and the backend is on Rails 7.1; the goal is Ruby 3.4.10 and Rails 8.1, in steps that each keep CI green and are independently deployable.
Why
mongoid 8.1.3declaresactivemodel >= 5.1, < 7.2. It is a hard resolution blocker for Rails 7.2 —bundle update railscannot work around it.Mongoid 9.1 declares
activemodel >= 5.1, < 8.2, so it supports Rails 7.1 and 8.1. That means this can land on Rails 7.1, before the framework bump, where a failure is unambiguous. Verified:rails 7.1.6 + mongoid 9.1.0resolves cleanly.Why this one is on its own
Highest-risk change in the sequence. Major ODM version, and it pulls
mongo2.20 -> 2.25 andbson4.15 -> 5.2 (a major bump). 15 models includeMongoid::Document.Scope / things to work through
Mongoid.load_defaults 9.0inconfig/initializers/mongoid.rb(currently8.1). Consider landing the gem bump on8.1first and flipping defaults in a follow-up commit.BSON::ObjectIdmonkey patch in that initializer (it aliasesto_json/as_jsontoto_s) still behaves under bson 5. This one patch shapes every ID in every API response. Mongoid 9 also ships an ActiveJob serializer forBSON::ObjectIdwhich may make part of it redundant.Mongoid::Document.send(:include, ActiveModel::SerializerSupport)and theMongoid::Criteria.delegate(:active_model_serializer, ...)line in the same initializer are AMS 0.9 glue — exercise the controller specs specifically.touch: true. Checked: this app has zeroembeds_many/embeds_one—Checkinuseshas_manywithclass_name: "Checkin::Treatment"etc. So the new default does not apply.symmetric-encryptionregistersMongoid::Fields.option :encrypted, which is the linchpin of the Postgres<->Mongoencrypted_user_idlink. Checked: Mongoid 9's CSFLE uses theencrypt:option, notencrypted:, so there is no collision. Still worth a smoke test round-tripping aCheckinthroughencrypted_user_idback to a PostgresUser.supercharge/mongodb-github-actionpin in CI) is still supported by mongo driver 2.25. If not, bumping the server image should land first.Sibling gems to re-verify:
cancancan-mongoid,kaminari-mongoid,database_cleaner-mongoid,mongoid-rspec.Acceptance criteria
encrypted_user_idround-trip verifiedBlocked by
#880 (upgrade prep). Blocks #883.
Part of the Ruby + Rails upgrade sequence. Ruby 3.2 reached end of life on 2026-04-01 and the backend is on Rails 7.1; the goal is Ruby 3.4.10 and Rails 8.1, in steps that each keep CI green and are independently deployable.