Modules
Published for Scala 3.9 LTS under now.sendline:
"now.sendline" %% "mongo4s-<module>" % "6.0.0"| Module | Notes | |
|---|---|---|
| core | mongo4s-core |
MongoClient/MongoDatabase/MongoCollection, Field/Filter/Update, PrimaryKey, WithId; depends on bson-core + bson-direct only |
| bson | mongo4s-bson-core |
BsonEncoder/BsonDecoder/BsonDocumentCodec — the scalar + document codec seam |
mongo4s-bson-direct |
WireCodec[A] — AST-free product/sum derivation, no third-party dependency |
|
mongo4s-bson-cats-data |
cats.data (NonEmptyList/Chain/NonEmptyVector/NonEmptySet/NonEmptyMap/Ior) instances |
|
mongo4s-bson-medeia |
bridges medeia's derives BsonDocumentCodec |
|
mongo4s-bson-zio |
bridges zio-bson (add zio-schema-bson yourself for the Schema-derived route) |
|
mongo4s-bson-calypso |
bridges calypso's forProductN |
|
| runtime | mongo4s-cats |
cats-effect 3 + fs2 |
mongo4s-zio |
ZIO 2 + zio-streams |
|
mongo4s-kyo |
kyo 1.0.0-RC7 | |
mongo4s-rapid |
rapid | |
| repositories | mongo4s-repositories |
BaseMongoRepository, Repository, Page |
| testkit | mongo4s-testkit |
FakeMongoCollection, FakeRepository, FakeCounters — in-memory doubles for unit tests |
Every module is built with the same Scala version, so there is no longer a subset that a project on an older compiler has to do without.
Java. The published class files target Java 17, so every module runs on JDK 17 or newer — except mongo4s-kyo,
whose kyo dependency ships Java 25 class files and so needs JDK 25 at runtime as well as to build. Building the
project itself needs JDK 25 throughout.
MongoDB. The integration suite runs against MongoDB 8.2, and Atlas Search against the mongodb-atlas-local 8.2
image. A few operations need a newer server than the driver's minimum: $median/$percentile and the ranking
accumulators need 7.0, and the client-level bulkWrite and a sort on updateOne/replaceOne need 8.0.
Compatibility
Binary compatibility within a major version is checked by MiMa on every build,
new Effect/RsBridge methods carry default implementations, and deprecations get at least one minor release before
removal. mongo4s-kyo sits outside the promise while kyo is on a release candidate.
6.0.0 moves mongo4s to the now.sendline organization and changes nothing else: the code is 5.1.1's, the package is
still mongo4s, and MiMa checks it against org.mongo4s 5.0.0 and 5.1.1. Swapping the organization in
build.sbt is the whole upgrade. org.mongo4s 6.0.0 is published as a relocation, so a build that only bumps the
version is moved to now.sendline by Maven and by sbt. The repository is
sendline-now/mongo4s, and the site is
oss.sendline.now/mongo4s.
5.0.0 is a breaking release, almost entirely in binary shape rather than in what a call says: most existing calls
compile unchanged against it. insertOne/insertMany take options, bulkWrite takes BulkWriteOptions instead of
an ordered flag, $addFields takes computed fields rather than raw BSON pairs, and several AST cases changed
shape — Group's key, Filter.Expr, Filter.Type, Update.CurrentDate, Projection.Include,
Stage.Unwind/UnionWith/Redact, and the bulk delete commands. FindQuery, AggregateQuery, DistinctQuery,
MongoCollection and MongoClient gain members an implementation of your own has to provide. Two behaviours change
without a compile error: containsAll(Nil) matches nothing, as $all: [] does on the server, and a sort on
updateMany is refused rather than dropped. Each has a migration note in COMPATIBILITY.md.
5.1.0 is binary compatible with 5.0.0 and is mostly what services moving onto the direct codec path were
writing by hand: a ScalarWireCodec answers as the BsonEncoder and BsonDecoder of its type,
BaseMongoRepository.direct and PrimaryKey.of build a repository over a WireCodec keyed on the entity's own
fields, and @stored, named scalar representations, Map keys beyond String and Float/Short/Byte/Char/
Array[Byte] cover the shapes existing collections already have. A few things change without a compile error —
set(None) renders $unset, a filter that matches nothing renders an empty $in on _id, refusals are raised in F
rather than thrown where the call is built, and on zio a defect stays a defect. Each has a note in
COMPATIBILITY.md.
5.1.1 is binary compatible with 5.0.0 and 5.1.0. It moves to MongoDB driver 5.14.0: on 5.13.0 a large reply
that reached the client in many small reads — over TLS, or through Docker Desktop's host.docker.internal — overflowed
the driver's I/O thread and left the call waiting forever. On kyo, a finalizer given to guaranteeCase or
bracketCase now sees an interrupted body as ExitCase.Canceled rather than as an error.
5.0.1 is binary compatible with 5.0.0 and fixes code the library inlines into yours: a derived WireCodec with
a default parameter, and PrimaryKey.compound, carried Scala 3.10's deprecated ArrowAssoc into the calling code,
which a build with -Werror refused. The library is built on Scala 3.9 LTS and used from newer compilers, so the
integration tests now compile on 3.10 against it — the side of the jar its users are on.
4.0.0 changes shapes MiMa would flag, and behaviour a recompile alone would not reveal: an Update that changes one
path twice is refused rather than keeping only the last change, findPage returns a KeysetPage with its next
cursor, watchAttempting keeps the event whose document failed, distinct over an array answers with its elements,
the operators that only apply to one kind of field stop compiling on the others, and the testkit's fake streams
through the RsBridge instead of taking an emit function. MongoCollection gains members an implementation of your
own has to provide, Stage gains cases an exhaustive match has to cover, and the fake's listIndexes answers the
way the server does. Each has a migration note in COMPATIBILITY.md.
3.0.0 moved the whole build onto Scala 3.9 LTS and dropped 3.3 LTS. TASTy is not forward compatible, and that
is a break MiMa cannot see, which is why it took a major release rather than a minor. What it buys is one Scala
version across every module: the three that used to be pinned to a fast-release 3.8 are on the LTS line with the
rest. It carried API changes of its own — compound PrimaryKeys became named tuples, WireCodec no longer
derives itself unasked, and driver exceptions arrive as MongoError — each with a migration note in
COMPATIBILITY.md.
Full policy, the migration guides and the Scala-version rules: COMPATIBILITY.md. What changed in each release: CHANGELOG.md. What is not covered yet and how it will land: ROADMAP.md.