https://kotlinlang.org logo
#feed
Title
a

Ashni Mehta

07/03/2023, 3:39 PM
Hi all! PM at MongoDB here -- we just released an officially-supported server-side Kotlin driver. More details in this blog post!
👍🏾 2
🙌 3
👍🏻 1
👍 8
K 9
🙂 1
K 16
c

CLOVIS

07/03/2023, 4:05 PM
Hi, thanks for the announcement! We've been following the documentation being written for a while 🙂 A few questions: • is multiplatform support planned? Right now, my understanding is that it's a wrapper around the Java driver? • is KMongo-like syntax (
/
) for accessing deep fields planned? I understand it's not a feature at the moment. If it's not planned, what is the way to make an edit to a deep field (e.g. an update to
{ "a.b.c": "foo" }
) • I don't see any mentions of aggregations in the blog post, is there any specific information we might be interested in?
As a smaller note, there is a missing link here 🙂
p

Piotr Krzemiński

07/04/2023, 11:25 AM
@Ashni Mehta awesome! one small nit: the Kotlin logo here is obsolete, take a look at https://kotlinlang.org/
also, does it make KMongo obsolete? is there full feature parity?
m

Marcin Wisniowski

07/05/2023, 3:28 PM
Looks good, I've been using KMongo so far, is it a replacement?
a

Ashni Mehta

07/07/2023, 4:08 PM
Hi folks! Appreciate the feedback so far -- and nice catch on both on the Kotlin logo and the missing link, we've updated both 🙂 To answer some questions, yes, it's a wrapper around the Java driver, similar to kmongo. For multiplatform mobile, we have the Realm Kotlin SDK, but outside of the mobile space, we don't have multiplatform on the roadmap for now. That being said, happy to discuss if that's something you'd need for your use case! There are some key differences between kmongo and the Kotlin driver, and they are outlined in this page of the docs. The Kotlin driver is an official driver, with MongoDB support, for folks who might not be able to use an unofficial third-party driver like kmongo to connect to MongoDB, but who still want to use Kotlin. Regarding aggregation, I'd recommend checking out our Aggregation Guide in Kotlin as well as this page on using Builders with Aggregation Expressions.
👍 1
c

CLOVIS

07/07/2023, 4:13 PM
W.r.t multiplatform: it's very experimental at the moment, but I am interested in the possibility of a WASM mongodb driver in the future, especially now that Kubernetes supports containerless WASM. Can you clarify how to access nested fields with the official driver? E.g. with KMongo:
Copy code
@Serializable
class A {
    val a: Int,
}

@Serializable
class B {
    val b: A,
}

collection.findOne(
    B::b / A::a gt 1,
)
I have only seen examples in the official driver's documentation where fields are used directly as-in, without nesting. Sorry if I missed any.
a

Ashni Mehta

07/10/2023, 1:50 PM
I'll make a note of that, appreciate the feedback! Regarding nested fields -- there isn't any DSL in the Kotlin driver for look ups at the moment. To access nested fields, you can use raw Kotlin and the
Filters
api eg:
<http://Filters.gt|Filters.gt>("${B::b.name}.${A::a.name}", 1)