Skip to content

Conversation

@joshuamegnauth54
Copy link

The bson crate supports useful helper APIs for chrono, jiff, and other crates. These feature flags aren't exposed through this crate even though it re-exports bson. This commit simply exposes those features for users so that they don't have to depend on bson directly.

This is useful for a few reasons. The first is that depending on a separate copy of bson will likely bring in a version different than that of the mongodb crate. The different types can conflict as mongodb::bson::Bson is different from bson::Bson.

The second reason is that two copies of the same crate leads to binary bloat. It's likely that tree shaking can't remove either copy because the re-exported bson is used within the mongodb crate. Both crates, as well the transitive dependencies that differ, will be included in the crate graph.

The third reason is that it's simply more ergonomic to have these features exposed through mongodb too rather than including a separate crate.

The `bson` crate supports useful helper APIs for `chrono`, `jiff`, and
other crates. These feature flags aren't exposed through this crate even
though it re-exports `bson`. This commit simply exposes those features
for users so that they don't have to depend on `bson` directly.

This is useful for a few reasons. The first is that depending on a
separate copy of `bson` will likely bring in a version different than
that of the `mongodb` crate. The different types can conflict as
`mongodb::bson::Bson` is different from `bson::Bson`.

The second reason is that two copies of the same crate leads to binary
bloat. It's likely that tree shaking can't remove either copy because
the re-exported `bson` is used within the `mongodb` crate. Both crates,
as well the transitive dependencies that differ, will be included in the
crate graph.

The third reason is that it's simply more ergonomic to have these
features exposed through `mongodb` too rather than including a separate
crate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant