Oolong - Quill-like query DSL for MongoDB (Scala 3 - only)

Hi everyone! I’m happy to announce oolong - a compile-time query DSL for MongoDB inspired by ideas of Quill

Just for a quick taste:

import org.mongodb.scala.bson.BsonDocument

import oolong.dsl.*
import oolong.mongo.*

case class Person(name: String, address: Address)

case class Address(city: String)

val q: BsonDocument = query[Person](p => p.name == "Joe" && p.address.city == "Amsterdam")

// The generated query will be displayed during compilation:
// {"$and": [{"name": {"$eq": "Joe"}}, {"address.city": {"$eq": "Amsterdam"}}]}
  
// ... Then you run the query by passing the generated BSON to mongo-scala-driver

oolong can be easily obtained from maven central by adding "io.github.leviysoft" % "quill-mongo" % "0.1"

4 Likes