---
title: "bson 5.0.0 Breaking Changes on RubyGems | Since.dev"
description: "What each bson release removed, renamed or changed: 12 breaking changes in 4 versions on RubyGems, each with its source."
canonical_url: https://since.dev/packages/gem/bson
last_updated: 2026-12-04
---

# bson breaking changes

bson 5.0.0 (February 13, 2024) is its newest release with breaking changes, 5 of them. The first: Removed validating_keys. Every breaking API change we have recorded in bson on RubyGems: 12 breaking changes in 4 versions. Below, its 4 versions with breaking changes, newest first, removals and renames first, each with its source.

Updated December 4, 2026

Latest version `5.2.1`, released November 25, 2026. [Source repository](https://github.com/mongodb/bson-ruby)

Packages on RubyGems run on Ruby. [Ruby end of life dates](https://since.dev/calendar/ruby.md).

- From [4.0.0](#v-4-0-0) to [5.0.0](#v-5-0-0): 5 breaking changes in 1 version.
- From [2.0.0](#v-2-0-0) to [5.0.0](#v-5-0-0): 8 breaking changes in 3 versions.

## bson 5.0.0 breaking changes

bson 5.0.0, released February 13, 2024: 5 breaking changes.

- **Removed** `validating_keys`  

The validating_keys option was removed from the API. Code that sets it must stop doing so. [github.com](https://github.com/mongodb/bson-ruby/releases/tag/v5.0.0)
- **Behavior changed** `BSON.ObjectId.as_json`  

ObjectId#as_json now returns a String without the '$oid' wrapper. Code that reads the '$oid' key from its output must be updated. [github.com](https://github.com/mongodb/bson-ruby/releases/tag/v5.0.0)
- **Behavior changed** `BSON.ObjectId.to_json`  

ObjectId#to_json now returns a String without the '$oid' wrapper. Code that reads the '$oid' key from its output must be updated. [github.com](https://github.com/mongodb/bson-ruby/releases/tag/v5.0.0)
- **Behavior changed** `BSON.Regexp.Raw`  

BSON::Regexp::Raw no longer accepts integers as options. Code passing integer options must switch to string option flags. [github.com](https://github.com/mongodb/bson-ruby/releases/tag/v5.0.0)
- **Default changed** `BSON.Decimal128`  

Decimal128 values now deserialize to BigDecimal by default instead of the previous type. Code relying on the old return type must be updated. [github.com](https://github.com/mongodb/bson-ruby/releases/tag/v5.0.0)

## bson 4.0.0 breaking changes

bson 4.0.0, released December 7, 2015: 2 breaking changes.

- **Behavior changed**  

Ruby Symbols are serialized to String bson types instead of their previous BSON type. Code that depends on the old serialized type must be updated. [github.com](https://github.com/mongodb/bson-ruby/releases/tag/v4.0.0)
- **Behavior changed** `Integer.to_bson_key`  

Integer#to_bson_key now returns a String instead of its previous result. Code that relies on the old return value must be updated. [github.com](https://github.com/mongodb/bson-ruby/releases/tag/v4.0.0)

## bson 3.0.0 breaking changes

bson 3.0.0, released February 18, 2015: 1 breaking change.

- **Behavior changed** `BSON.Regexp.Raw`  

Regular expressions that are deserialized now return a BSON::Regexp::Raw instead of a Regexp object. Call #compile on the returned object to get a compiled regular expression. [github.com](https://github.com/mongodb/bson-ruby/blob/v3.0.0/CHANGELOG.md)

## bson 2.0.0 breaking changes

bson 2.0.0, released December 2, 2013: 4 breaking changes.

- **Removed** `BSON.DEFAULT_MAX_BSON_SIZE`  

The constant was removed because the BSON specification sets no upper limit on document size. Code that references it will fail. [github.com](https://github.com/mongodb/bson-ruby/blob/v2.0.0/CHANGELOG.md)
- **Removed** `BSON.deserialize`  

Call from_bson on Hash or BSON::Document with a StringIO instead of BSON.deserialize. [github.com](https://github.com/mongodb/bson-ruby/blob/v2.0.0/CHANGELOG.md)
- **Removed** `BSON.serialize`  

Call to_bson on a Hash or BSON::Document instead of BSON.serialize to get the raw bytes of a document. [github.com](https://github.com/mongodb/bson-ruby/blob/v2.0.0/CHANGELOG.md)
- **Behavior changed** `to_json`  

to_json on BSON::Binary, BSON::Code, BSON::CodeWithScope, BSON::MaxKey, BSON::MinKey, BSON::ObjectId, BSON::Timestamp and Regexp now produces the BSON specification format, so code that parses that output must change. [github.com](https://github.com/mongodb/bson-ruby/blob/v2.0.0/CHANGELOG.md)

## Check your code

These are the changes. To see which of them reach your code, [scan a public repository](https://since.dev/scan.md), or have your coding agent call `check_code` with your manifest or lockfile over [MCP](https://since.dev/docs.md#mcp). [The API](https://since.dev/docs.md#api) reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
